Game Manager


In this update I am trying to implement a  Game manager into my Unity project. Not a very special thing or visual thing, as it is more code based. 

Scene Hierarchy that loads the different scenes into Boot Scene

Though the game is relatively simple , I felt it would be good to build some structure and modularity into the game. I never really though about the game as a collection of systems till I came across training from Unity Learn.

https://learn.unity.com/project/swords-and-shovels-game-managers-loads-and-the-g...

By creating a game manager it can save time linking files or calling assets. The structure is simple is a scene file with a special script titled "GameManager.CS" that load the other scenes and unload scenes when it ends.

For now the role of the game manager is to track scenes and the game state and the final score of the game. 

Something I have never thought about before. In my previous game Endless Runner for UE4 I just hard coded the sequence of actions which got messy as I progressed and had a hard time to keep track of things. Modularity in the App is important. cause I work on this part time and on different parts breaking things into smaller functions / code is more digestible and code can be resued across projects.

Sample Code is here:

https://github.com/cgbosss/Spaceship_2D_Unity/blob/master/Assets/Scripts/GameManager.cs

Loading Bar

One other thing I am trying to do is a loading bar between scenes but I might leave that for later.

Thanks to brakeys again for providing the code.

Resources:

Unity 3D Learn Game Managers: https://learn.unity.com/project/swords-and-shovels-game-managers-loads-and-the-g...

GameDev Beginner Loading a Scene: https://gamedevbeginner.com/how-to-load-a-new-scene-in-unity-with-a-loading-scre...

Leave a comment

Log in with itch.io to leave a comment.