Unity project structure
Introduction
The Unity project is divided in two main folders:
- Core: This folder contains the source files of the Go server and the core C# source files that allow a Unity game to communicate with the Go server via the REST-based API provided by the kit.
- Demo: This folder contains the source files of the C# game client demo. It is intended as a practical example of how a game client that uses the kit would look like; in the real world, you will replace/modify this as needed by your game.
Let's go over these folders in more detail next.
Core
These are the core C# scripts:
- GameServer: The main component of every game server instance in the game. It inherits from Mirror's NetworkManager.
- Client: The main interface with the Go server. This interaction happens via REST calls.
- ClientConfig: The configuration asset that allows you to easily define in the Inspector the IP address and port number of your Go server. This is a convenient way to manage different configurations (e.g., test, production, etc.).
- ClientObject: The MonoBehaviour wrapper around the Client class.
- RestApiTypes: The types used by the Client's REST-based API calls.
Demo
These are the demo C# scripts:
- Popup: The base class all popups in the demo inherit from.
- AlertPopup, LoadingPopup, LoginPopup and RegistrationPopup: The different types of popups used in the demo.
- PopupOpener: A convenience component to easily open a popup.
- Game and Lobby: These classes manage the appropriate Unity scene.
- RoomButton: The class that represents a game room button in the lobby scene.