What Language Does Unity Use? A Beginner’s Guide to C# Scripts

Unity uses C# for ordinary gameplay scripting. You write a class, let Unity compile it and attach the behaviour to an object when the class is a component. A door, camera and collectible can each have a small script with a clear responsibility. You do not need to learn the language used to implement the engine before writing your first game mechanic.

Follow one component from file to scene

Imagine a coin named Star. A C# component attached to Star describes how it reacts when a player enters its trigger. A Collider supplies the trigger geometry, and the relevant physics setup makes the event possible. The C# file in the Project window is an asset; the component attached to the scene object is the running instance. Editing a file without attaching or invoking it will not make anything happen.

Authoring chain — Write C# class, Attach componentWrite C# classAttach component
Authoring chain

Understand the Unity-specific part of C#

A MonoBehaviour can receive lifecycle callbacks such as Start and Update. Use Start for initial setup and Update for work that genuinely belongs on each frame. A score calculation or inventory rule can often live in an ordinary C# class instead. When a component needs a tunable speed or colour, expose an appropriate serialised field and inspect it on the correct object. Two objects using the same class can carry different field values.

Why C++ appears in Unity build discussions

Unity’s IL2CPP backend converts managed assemblies into C++ for a later native compilation step. That describes how certain builds are produced, not what gameplay authors must type. A rendering shader or a native plug-in can use another language for a specialised job. If an old tutorial teaches UnityScript, choose a modern C# example and match it to your editor version before debugging obsolete instructions.

Runtime check — Trigger the event, Observe the resultTrigger the eventObserve the result
Runtime check

For the documented workflow, see Unity component reference.

Common Questions

Does every C# class need MonoBehaviour?

No. Ordinary classes suit pure rules and calculations.

Is Visual Studio required?

You can use another supported C# editor.

Why is my script missing from Add Component?

Resolve compilation errors and check the component class and filename.

Does IL2CPP turn my source project into a C++ project?

No. It is part of the build pipeline.