Why would you use the StartGame function as opposed to just calling the Start function?
Typically you’d be creating a method for a specific action/behaviour, you could of course just throw all of your code into one huge method and it would most likely run, but when it comes to debugging it and trying to finds problems it will be much more challenging.
In the case of Number Wizard, consider also that you may want to restart the game, the
Start method is only called once when the scene loads, after that, it’s not call again until the scene is perhaps completely reloaded (imagine stopping and restarting your game, or pressing F5 on the keyboard for a web page etc). By placing your start game code in a separate method you can then call
StartGame from any other place in your code.
Hope this helps
Thanks Rob that was exactly what I was looking for.
You’re very welcome Thomas
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.