Summary
We looked into using Unity's Reference Manual and the Scripting Reference. As a beginner, probably the most time consuming part of writing code will be searching Unity's documentation for the information you need. We expanded the State Machine and added a Player GameObject. Planning ahead before writing code is always a good idea. A State Machine is a good option for organizing your project's code. Nine State classes were created for the State machine. We then displayed a splash screen and a button in BeginState
. For the SetupState
, we displayed a spinning Player and some GUI buttons to set Player options.
A major point to be taken from writing all this code is that public variables and methods in any class or script are easily accessed. All that's needed is a reference to an object, then you can use Dot Syntax to easily access data and methods.
In the next chapter, we will continue the game development by entering our first PlayState
and see how the State Machine...