- Home /
The best way to control a game flow?
Hi Guys! I am developing a game with unity and I get around just fine. I have prior experience with programming in many langues, but more often for web applications. Migrating to game programming was easy, and I could make all the stuff on my game myself, but today near the end of the main aspects of the game I am very concerned with structure and organization. I am trying to implement the logic for Loading--> Main Menu --> GamePlay -->Pause -->Options and so on, and I need to know if there is some design pattern or any other approach to implement this logic. I know about the DontDestroyOnLoad and stuff but I am wondering if there is some well used solution to that problem. Thanks in advance!
Or if someone can point me to the right direction. I would help me a lot! ;)
Answer by iwaldrop · Feb 13, 2013 at 06:52 AM
We typically use a Bootstrap MonoBehaviour and Scene that will load/fetch data from disk/web, initialize plugins, and load the splash screen and main menu scenes. The Bootstrap GameObject is marked don't destroy on load, as you mentioned, and it follows the singleton pattern so it's available to any script when necessary (though it is almost never necessary for game scripts to need to talk to Bootstrap). In reality, once the game is to the menu there is hardly a need for it at all anymore.
Long story short, you're already on the right track here with your thinking!
Additionally, google Unity bootstrapping to get examples of how others do it.
Interesting! Thank you very much! I will make this research! ;)