Unity fundamentals / 05

The structure of a C# script

Understand using directives, the script class, and the difference between Start and Update.

On this page

Original Unity tutorial series banner

Today, let's examine a script, one of the main building blocks of behavior in Unity. Open Unity and double-click the Move script we created. Visual Studio Code should open shortly afterward.

The Move script opened in Visual Studio Code

using directives

At the top, you will see lines beginning with:

using

These directives make names from other namespaces available in the file. The original describes this as using features from libraries: a useful introductory idea, though a using directive itself does not install or load a library.

The script class

The original text then shows this class declaration:

public class Move : MonoBehavior

The class is where the script's members and behavior live. Make sure its name matches the script asset. If the file is named Move.cs, the class should be named Move, rather than a default name left from creating a new script.

The Move script asset whose name must match the class

Editorial correction: Unity's base-class name is MonoBehaviour, with a u. The source's typed excerpt above misspells it as MonoBehavior. The intended declaration is public class Move : MonoBehaviour.

Start and Update

Next come methods. A function or method groups behavior that runs when called. Two common Unity lifecycle methods are:

void Start()
void Update()

Start() runs once before the component's first update when it becomes active. Update() runs once per rendered frame while the component is enabled.

Which runs first? Start.

Original illustration accompanying the explanation of Start and Update

Start is commonly used to initialize values, obtain references, or do one-time setup. Update commonly handles ongoing behavior such as frame-by-frame input or movement. Physics work has its own timing considerations, which become relevant later.

That is the basic script structure. Next, we will finally write movement code.

Moved here from Tistory

I migrated this post from my Korean Tistory blog, I am Jason Lee, to this website and translated it into English. My writing and projects now live together in one place.

The original publication date, code examples, and screenshots are preserved. Editorial notes clarify known issues in the original material.

Original post on Tistory English edition · Aug 30, 2026
← Back to all articles