This simple project shows a UI that allows the user to press a login button to login, and a logout button to logout. The project is built around clean architecture principles, with logic, services, dependencies and UI management decoupled from each other.
A lightweight dependency injection framework for Unity, so we can inject dependencies only into the classes that need them.
A pooled event dispatcher for Unity that allows game objects to be decoupled from each other, while generating minimal garbage allocations.
A Simple HTTP and REST client for Unity based on promises.
Add Sentry Unity SDK to capture any exceptions or error logs.
ProjectInstaller.cs - The entry point for the project scope and DI framework initialisation.
All project related configuration can be set here, and RealAuthenticationService or MockAuthenticationService can be easily swapped out
xMail.cs - Mail Man generated classes containing event dispatch data
MailSender.cs - A static class used to dispatch Mail Man events
A collection of models, enums, and interfaces
Services used to handle business logic, these services are typically injected into gameObjects that require them.
MockAuthenticationService - A mock class for testing the authentication service
RealAuthenticationService - A real class that makes an API request to authenticate the user
Repositories are used to talk to the data layer
PlayerPrefsRepository - A class that handles all the player prefs keys and reading/writing key data, this could easily be extended to talk to an external database.
AuthenticationController - A MonoBehaviour used to handle the authentication logic
PanelLoginView - A UI view used to handle the UI interactions of the Login and Logout Buttons, as well as update the UI state.