We'll need a class to practice with before we can understand their inner workings, so let's create a new C# script and start from scratch:
- Right-click on the Scripts folder, choose Create, and select C# Script.
- Name it Character, open it up in Visual Studio, and delete all the generated code after using UnityEngine.
- Declare a public class called Character followed by a set of curly braces, and then save the file. Your class code should exactly match the following code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Character
{
}
Character is now registered as a public class blueprint. This means that any class in the project can use it to create characters. However, these are just the instructions—to create a character takes an additional step. This creational step is called instantiation and is the subject of the next section...