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.

  1. Create a new Unity project and name it as State Machine.
  2. Right-click on in the Project tab and create a folder named Code.
  3. Right-click on the Code folder and a create a folder named Scripts.
  4. In the Scripts folder, create a C# Script.
  5. Immediately rename NewBehaviourScript to LearningScript.
    Time for action – create a C# script file

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.35.193