Search Unity

Experienced programmer, but new to Unity?
You’re already ahead of the game.

You have a major advantage from the get-go if you come to Unity with strong programming skills. Programming is essential to developing games, even the simplest ones. In Unity, you can use scripts to develop pretty much every part of your game or interactive content.

The Unity set of logical steps to build any kind of game

To understand how to create gameplay in Unity, you first need to know about the fundamental building blocks in Unity:

1. GameObjects

Every kind of content in Unity begins with a GameObject. Any object in your game is a GameObject: characters, lights, special effects, props–everything.

unity game object example

GameObjects can’t do anything on their own. To actually become something, you need give a GameObject properties, which you do by adding Components.

2. Components

Components define and control the behavior of GameObjects they are attached to. A simple example would be the creation of a light, which involves attaching a Light Component to a GameObject (see below).

unity game object light example

3. Variables

Components have any number of editable properties that can be tweaked via the Inspector window in the editor, and/or via script. In the above example, some properties of the light are range, color and intensity.

Programming gives you control over every object and its properties

Unity’s built-in Components are very versatile, but you will soon find you need to go beyond what they can provide to implement your own gameplay logic. Using scripts, you can implement your own game logic and behaviour by simply applying them to the game objects.

Your script Components will allow you to do many things: trigger game events, check for collisions, apply physics, respond to user input, and much, much more.

unity C# script icon

What programming languages can you use in Unity?

Unity supports C#, an industry-standard language with some similarities to Java or C++.

Are you coming to Unity from a C++ background?

In comparison to C++, C# is easier to learn. Additionally, it’s a “managed language”, meaning that it automatically does the memory management for you: allocating-deallocating memory, covering memory leaks, etc, which a lot of C++ beginners and pros alike have trouble with. Generally, C# is preferable to C++ if you want to make a game first, and then deal with more advanced aspects of programming later.

Debugging in Unity

Tweaking and debugging is efficient in Unity because all the gameplay variables are shown right as developers play, so things can be altered on the fly, without writing a single line of code. The game can be paused anytime or you can step-through code one statement at a time. You’ll find links to profiling and debugging docs and tutorials at the end of this page.

Scripting backend in Unity: MonoDevelop-Unity to be replaced with Visual Studio Community, starting in version 2018.1

.NET: Unity has used an implementation of the standard Mono runtime for scripting that natively supports C#. However, starting with version 2018.1, Unity will ship with Visual Studio for Mac instead of MonoDevelop-Unity on macOS. On Windows Unity will continue to ship Visual Studio 2017 Community, and no longer ship MonoDevelop-Unity.
The (currently experimental) .NET 4.6 scripting runtime in Unity will support many of the new exciting C# features and debugging available in C# 6.0 and beyond. This will also provide a great C# IDE experience to accompany the new C# features.

IL2CPP: is a Unity-developed scripting backend which you can use as an alternative to Mono when building projects for some platforms. When you choose to build a project using IL2CPP, Unity converts IL code from scripts and assemblies into C++ code, before creating a native binary file (.exe, apk, .xap, for example) for your chosen platform.
Note that IL2CPP is the only scripting backend available when building for iOS and WebGL.

unity .NET scripting backend

Customize Unity by extending the Editor

As a programmer you have a great deal of flexibility in Unity because you can extend the editor with your own custom windows that behave just like the Inspector, Scene or any other built-in windows in the standard editor. Adding your own tools to Unity supports you and your team’s unique workflows and needs, ultimately boosting efficiency.

More resources

Getting started in Unity guides
Get a practical guide with information and resources that will get you on your way, save you time, and help you gain the most value when developing 2D games or mobile games using Unity

Scripting tutorials
On this page you’ll find all of Unity’s own scripting tutorials, from beginner and intermediate, through to advanced editor scripting, Unity development with Visual Studio and live training sessions that teach you how to program simple games in Unity.

Scripting Documentation
Our excellent scripting docs cover all key topics, here are the top sections and pages to start with:

Unity Scripting Reference

Profiling, debugging, optimizing

Per platform


Get started with Unity

Got it

We use cookies to ensure that we give you the best experience on our website. Visit our cookie policy page for more information.