Programming in Unity refers to authoring your project’s functionality in code rather than through the Unity Editor UI. This allows you to go beyond what can be done in the Editor UI alone. Interacting directly with the public Unity APIs allows for finer control and a greater degree of customization.
Learning to program in particular languages is beyond the scope of this section. However, there are many books, tutorials, and other resources for learning how to program with Unity. Refer to learn for further details.
| Topic | Description |
|---|---|
| Get started with programming in Unity | Get started with creating, naming, and editing your first Unity scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info See in Glossary. |
| Environment and tools | Set up your software development environment with the right tools for programming in Unity. |
| Fundamental Unity types | Understand some of the fundamental C# types that Unity provides and their special significance and behavior in the Unity Editor and runtime. |
| Managing update and execution order | Understand the order in which Unity executes your script components and the lifecycle callbacks within those scripts during the runtime application loop. |
| Managing time and frame rate | Understand how Unity measures time so you can manage the rate at which time passes in your application and ensure values update according to the appropriate time scale. |
| Split tasks across frames with coroutines | Split the execution of a task synchronously across multiple scenesA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info See in Glossary with coroutines. This can be useful for tasks that should progress gradually over several frames, such as a fade out effect. |
| Interacting with web servers | Use the UnityWebRequest system to allow your application to interact with a web server via HTTP. |
| Handle type data generically with Unity Properties | Use the Unity Properties API to generically discover and manipulate object properties at runtime. |
| Programming with math | Use Unity’s mathematical APIs to apply trigonometric, logarithmic, and other functions in your application, move objects with vectors, and generate random values. |
| Compilation and code reload | How Unity transforms the code you write into code that runs, and the implications for development iteration times and your application’s runtime behavior. |
| Code optimization | Project configuration, design patterns, and coding strategies to help optimize the performance of your code. |
| Testing your code | Use the Unity Test Framework to write and run tests for your Editor or runtime code. |
| Debugging and diagnostics | Debug, diagnose, and fix problems in your code. |