Time for action – creating a script and a class
We are going to create the StateManager
script and the BeginState
class, then add some code so that we can instantiate BeginState
to make an instance of BeginState
. With the help of the next screenshot, perform the following steps:
- In the Unity Project window, create a C# Script in the
Scripts
folder. - Name the script
StateManager
. - Double-click on
StateMana
ger
to open it in MonoDevelop. - In the MonoDevelop Solution window, right-click on the
Code
folder and select Add | New Folder. - Name the folder
States
. - Right-click on the
States
folder and select Add | New File. - In the New File window, select General | Empty Class.
- In the Name field at the bottom, enter
BeginState
. - Click on the New button to create the
Get Learning C# by Developing Games with Unity 3D Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.