Traditional Unity projects are object-oriented in two related ways:
UnityEngine.Object
. In this model, 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 infoAn alternative to object-oriented development is data-oriented development, which is both a programming philosophy and a set of technologies that help you implement those principles. The data-oriented approach offers strong performance advantages at scale but can be more challenging for inexperienced developers to learn.
Object-oriented and data-oriented development are not mutually exclusive and you can combine elements from both. For information on data-oriented development, refer to Unity’s Data-Oriented Technology Stack.
Topic | Description |
---|---|
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. |
Instantiating prefabs at runtime | Instantiate prefabsAn asset type that allows you to store a GameObject complete with components and properties. The prefab acts as a template from which you can create new object instances in the scene. More info See in Glossary programmatically to create structures and impressive effects in your game with relatively little code. |
Handling events | Make your application responsive to events such as user input, object collisionsA collision occurs when the physics engine detects that the colliders of two GameObjects make contact or overlap, when at least one has a Rigidbody component and is in motion. More info See in Glossary, and physics and rendering updates. |
Splitting tasks across frames | Split the execution of a task synchronously across multiple scenes 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. |
Adding functionality to objects at runtime | Use the Unity Properties API to implement a visitor design pattern and add new operations to .NET objects at runtime. |
Moving objects with vectors | Use vectors to move objects in a specific direction and magnitude in 2, 3, and 4 dimensions. |
Using common math functions | Use common math functions, including trigonometric, logarithmic, and other functions in your application. |
Using randomness | Generate commonly required types of random values. |
Gizmos and Handles | Draw lines and shapes in the Scene viewAn interactive view into the world you are creating. You use the Scene View to select and position scenery, characters, cameras, lights, and all other types of Game Object. More info See in Glossary and Game view, as well as interactive handles and controls. |
Null references | Understand and diagnose null reference exceptions in Unity projects. |
Unity attributes | Use Unity-specific C# attributes to define special behavior for your code. |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.