Skip to content

sebastien6/UnityFullStackSample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UnityFullStackSample

Design

Backend

The backend is a golang GPRC microservice application with a RestAPI gateway. The gateway provides a web server to server the RestAPI call and the openapiv2 User Interface.

The GRPC listing application provide the service and store the data in a mongodb database.

A layer of abstraction was created between the GRPC service and the database making it easy in case of the replacement of the database by another one with limited code changes.

The api version and user input validation was declared as part of the proto file definition.

base URL

unity app

  • In the folder unity\Assets\Scripts\Runtime a new folder 'RestClient' was created with a file RestClient.cs that contain the code use to make the RestAPI calls.
  • In the file, unity\Assets\Scripts\Test\TestListings.cs, a SerializeField baseUrl was added to set the URL for the backend RespAPI service to call. (example: http://localhost:8080/api/v1/games)

base URL

  • UIEntity.cs and Listing.cs were modified to accomodate the image upload.

When the application is run, the list of games is loaded and related images uploaded.

unity app

Test

  1. clone repository
git clone github.com/sebastien6/UnityFullStackSample
  1. create a docker bridge network
docker network create -d bridge unity_app
  1. go to directory app, build the docker image and launch the backend application
docker-compose build
docker-compose up

backend service

when the service is ready, the web URL for health check will return 'ok'

  1. open Unity engine and open the unity app in folder unity of this repository

Backend Web Service

To test the backend service open http://localhost:8080/healthz

healthz

To access the openapiv2 UI, open http://localhost:8080/openapiv2

Challenges

  • first time coding in C# (understand language syntaxt, and concepts)
  • first time scripting with unity (understand specificty of unity with C# like coroutine)
  • deciding on the architecture (was with so many possibilities)