The best architecture to create Unity project based on Canvas and is flexible enough to be implemented even on top of ECS or OOP.
This is a sample project I have made to demonstrate the AMVC architecture. It consists of two scene:
- Loading Scene : when we send few requests to fill our models with the necessary data. The loading system based on Command Design Pattern to make it flexible when we need to reload or skip some thing or even to handle errors more efficiently. and the DataBaseManager is a helper class I made it on top of Rest Client for Unity plugin.
- Main Scene : I consume the Api result with two different ways to explain how the Controller (Systems) and Views (Panels) communicate.
Also you will notice that all my UI Panels are a canvases. and the reason to use multiple canvases is to avoid regenerates the meshes when UI elements change Read More about it
The Application Model View Controller (AMVC) solve any dependencies issues by splits the software into :
- Single entry point "Application" : contains and manage all critical instances and application-related data.
- Three major components:
- Models : Data CRUD.
- Views : UI Panels (Canvas Component).
- Controllers : Application systems.
we can get access to any panel/system from anywhere! with GetPanel<T> and GetSystem<T> we can get a reference easily.