Time for action – create a C# script file
As our Unity project progresses, we will have several folders to organize and store all of our C# files.
- Create a new Unity project and name it as
State Machine
. - Right-click on in the Project tab and create a folder named
Code
. - Right-click on the
Code
folder and a create a folder namedScripts
. - In the
Scripts
folder, create aC# Script
. - Immediately rename
NewBehaviourScript
toLearningScript
.
What just happened?
We created one of the Code
subfolders, named Scripts
, that we will be using to organize our C# files. This folder will contain all of our Unity script files. Later we will create other C# file folders.
We also used Unity to create a C# script file named LearningScript.cs
.
Introducing the MonoDevelop code editor
Unity uses an external editor to edit its C# scripts. Even though Unity can create a basic starter C# script for us, we still have to edit the script using the MonoDevelop code editor that's included with Unity.
Syncing C# files between MonoDevelop and Unity
Since Unity and MonoDevelop are separate applications, Unity will keep MonoDevelop and Unity synchronized with each other. This means that if you add, delete, or change a script file in one application, the other application will see the changes automatically.