Best Practices
Please make sure to follow Unity's best practices and write clean, efficient, and maintainable code when integrating your gameplay!
In Game UI
To create your Gameplay UI elements, the easiest way is to use the Gameplay Canvas of the Sample scene. However, if you use your own canvas, in order to facilitate the integration of your Gameplay UI into the full template, please check that you have a root canvas with theses settings:
- Canvas Render Mode set to
Screen Space - Overlay - Canvas Scaler set to
Scale With Screen Size - Reference Resolution
X 1080 Y 1920
Then create a sub-Canvas for your gameplay UI and place all your UI Elements inside it. You can use the provided GameStateCanvasEnabler component to enable it only for the Gameplay state.
Camera(s)
For simplicity sake, the Lite template only includes a basic Main Camera. In real situation though, your gameplay might need multiple cameras. For instance, a common setup is one camera for the Home state, one during the Gameplay state and one for the End Game.
As we saw earlier in the doc, you can easily listen to OnLevelStart, OnLevelEnd, and OnReturnToHome to enable and disable your cameras depending on the game state.
Feel free to use any camera system you prefer. We use Cinemachine in the full template, so it is recommended to use it as well for an easier integration.