On this page
- Unity set of logical steps to build any kind of game
- Programming gives you control over every object and its properties
- What programming languages can you use in Unity?
- Are you coming to Unity from a C++ background?
- Debugging in Unity
- Scripting backend in Unity
- Customize Unity by extending the Editor
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:
Every kind of content in Unity begins with a GameObject. Any object in your game is a GameObject: characters, lights, special effects, props–everything.
GameObjects can’t do anything on their own. To actually become something, you need give a GameObject properties, which you do by adding 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).
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.
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.
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.