Version: 2022.2
Language : English
3D game development quickstart guide
Advanced best practice guides

Creating a 3D game

To create a 3D game, set up your Unity project and then familiarize yourself with the relevant concepts in the following order:

Fundamentals

GameObjectsThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary
are fundamental objects in Unity that represent characters, props, scenery, and more. Every object in your game is a GameObject.

GameObjects live in 3D environments called 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
. You can think of a scene as a game level, but it might also represent a menu, the credits at the end of the game or something else entirely.

The behavior of GameObjects is defined by blocks of functionality called components. You can attach multiple components to GameObjects. The following components are fundamental for 3D games:

  • Transform: the Transform componentA Transform component determines the Position, Rotation, and Scale of each object in the scene. Every GameObject has a Transform. More info
    See in Glossary
    determines the Position, Rotation, and Scale of each GameObject in the scene. Every GameObject has a Transform component.
  • Mesh FilterA mesh component that takes a mesh from your assets and passes it to the Mesh Renderer for rendering on the screen. More info
    See in Glossary
    : this component defines the shape of a 3D GameObject.
  • Mesh RendererA mesh component that takes the geometry from the Mesh Filter and renders it at the position defined by the object’s Transform component. More info
    See in Glossary
    : this component defines how the 3D shape defined by the MeshThe main graphics primitive of Unity. Meshes make up a large part of your 3D worlds. Unity supports triangulated or Quadrangulated polygon meshes. Nurbs, Nurms, Subdiv surfaces must be converted to polygons. More info
    See in Glossary
    Filter looks.
  • CamerasA component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
    See in Glossary
    : specially-configured GameObjects that capture and display the world to the player.
  • RigidbodyA component that allows a GameObject to be affected by simulated gravity and other forces. More info
    See in Glossary
    : Rigidbodies allow GameObjects to interact with the Physics system, including gravity and 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
    . See the Physics section of this guide.
  • CollidersAn invisible shape that is used to handle physical collisions for an object. A collider doesn’t need to be exactly the same shape as the object’s mesh - a rough approximation is often more efficient and indistinguishable in gameplay. More info
    See in Glossary
    : this component defines the shape of a 3D GameObject for the purpose of physical collisions.

Back to Top

Scripting

Unity allows you to create your own Components using 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
. Scripts let you trigger game events, modify Component properties over time and respond to user input. Unity supports the C# programming language natively. Here some examples of how you can use scripts in your game:

  • To receive input from the player and have a GameObject move or act based on that input.
  • To set win and lose states which open relevant win or lose scenes to create a full game loop.
  • To affect the components of GameObjects, such as their transform, animation, or renderer, based on other variables.

For details on how to use scripts in Unity, see Scripting Overview. To learn the fundamentals of scripting, follow the Unity Learn Beginner Scripting course. For more in-depth guidance, see the example projects Create with Code and Creator Kit: Beginner Code.

Back to Top

3D Assets

Models are 3D representations of objects. The majority of the visuals for 3D games consist of models, such as characters, interactable objects, and the world around the player.

You can use tools like Probuilder to create models in Unity. However, these work best for prototyping, rather than for the final product.

To add more polished 3D assets to your final product, create 3D Models, Materials and Textures in 3D modeling software and then import them into Unity.

Left: A 3D polygon mesh for a player character. Right: The player mesh rendered in Unity with materials
Left: A 3D polygon mesh for a player character. Right: The player mesh rendered in Unity with materials

Importing 3D Model Files

Unity uses the .fbx model format. You can also use other common native model formats (for example, .max, .blend, .mb, .ma), and Unity converts them into .fbx once they are imported.

Import models into Unity to use them in your project.

Rendering Meshes

A 3D mesh is the structural build of a 3D model. It is made up of multiple polygon shapes. To add a 3D model to a GameObject, add a Mesh Filter to the GameObject. The Mesh Renderer component renders meshes in your scene; to ensure models appear in your game, add a Mesh Renderer to any GameObject that has a Mesh Filter component.

Materials

MaterialsAn asset that defines how a surface should be rendered. More info
See in Glossary
combine information about the visual appearance of a surface, such as TexturesAn image used when rendering a GameObject, Sprite, or UI element. Textures are often applied to the surface of a mesh to give it visual detail. More info
See in Glossary
, color tints, and ShadersA program that runs on the GPU. More info
See in Glossary
. Use Materials to define how to render surfaces.

  • Textures are any 2D image files that you import into Unity. Use Textures to wrap a mesh and add fine detail to a model.
  • Use Color tints to alter the color of the texture.
  • Shaders are a series of instructions which determine how Unity displays GameObjects on screen. Use Shaders to affect how Unity renders each pixelThe smallest unit in a computer image. Pixel size depends on your screen resolution. Pixel lighting is calculated at every screen pixel. More info
    See in Glossary
    based on lighting input and Material configuration.

See the Learn Tutorial on Material Design.

Back to Top

Building in-game environments

An environment has been created by adding models and other assets to the scene.
An environment has been created by adding models and other assets to the scene.

Environment design is the process of creating an environment for gameplay to take place in. You might design and build your environment at the same time in the Unity Editor, or you might design an environment outside of Unity and then build it in Unity.

To build an in-game environment, you add GameObjects to the scene and position them to suit your preference and design. In addition to hand-placing your models in the scene, the Unity Editor includes a built-in set of TerrainThe landscape in your scene. A Terrain GameObject adds a large flat plane to your scene and you can use the Terrain’s Inspector window to create a detailed landscape. More info
See in Glossary
features that allow you to add landscapes to your game. In the Editor, you can create multiple Terrain tiles, adjust the height or appearance of your landscape, and add trees or grass to it. Read more about Creating and Using Terrains.

Back to Top

Animation

You can import animations made in other programs, or animate your assets directly in the Editor. For more information on 3D animation, see the Unity Learn Course Introduction to 3D Animation Systems.

The player is standing still so the idle animation is playing.
The player is standing still so the idle animation is playing.

Importing Animations

Unity can import animation clips when you import a model with animation. This means you can animate models in another program and then access and manipulate the clips in Unity.

Animating Models in Unity

Use the Animation window to create and modify Animation Clips directly inside Unity. Use KeyframeA frame that marks the start or end point of a transition in an animation. Frames in between the keyframes are called inbetweens.
See in Glossary
animation to add simple animations to a GameObject within your scene, such as changing its position, size, or rotation.

Controlling animations

To control which Animation ClipsAnimation data that can be used for animated characters or simple animations. It is a simple “unit” piece of motion, such as (one specific instance of) “Idle”, “Walk” or “Run”. More info
See in Glossary
play, you can call them directly in a script with the Animator Class, or create and modify the Animator ControllerControls animation through Animation Layers with Animation State Machines and Animation Blend Trees, controlled by Animation Parameters. The same Animator Controller can be referenced by multiple models with Animator components. More info
See in Glossary
in the Animator windowThe window where the Animator Controller is visualized and edited. More info
See in Glossary
.

You can use the Animator window to:

Back to Top

Graphics

Lighting

Light your Scenes to add depth and mood to your environments and to help the player experience the game world you’ve created. To set up lighting:

  1. Create a Light. Right-click in the Hierarchy window to open the GameObject menu, select Light, and select a type of Light to add to your scene. See Types of Light.
  2. Place your Lights in the Scene. Adjust the color, intensity, and placement of your Lights until you achieve the desired effect. See Using Lights.
  3. Perfect your lighting. For example, you can choose a different Light modeA Light property that defines the use of the Light. Can be set to Realtime, Baked and Mixed. More info
    See in Glossary
    , or add a cookie mask to create shadows.
A spotlight Light creates atmospheric lighting in this scene
A spotlight Light creates atmospheric lighting in this scene

See the Unity Learn Lighting in URP tutorial.

Back to Top

Audio

You can add background music and sound effects to your game in Unity; see Audio Overview. Use third-party software to create your audio and import it into Unity with the recommended settings.

Back to Top

Physics

The Player character has a capsule collider component which uses the Physics system to allow the character to collide with the walls.
The Player character has a capsule collider component which uses the Physics system to allow the character to collide with the walls.

Use Unity’s physics engineA system that simulates aspects of physical systems so that objects can accelerate correctly and be affected by collisions, gravity and other forces. More info
See in Glossary
to control how GameObjects interact. You can use this to replicate forces such as gravity and mechanics, which define how GameObjects behave on collision in the real world. You can also configure the physics settings to create custom physics to fit the design of your game, which might not be an accurate simulation of the real world. To learn how to use Unity’s physics engine, see the Unity Learn Physics tutorial. See the Physics section of the User Manual for more information.

To set up Physics for your GameObjects:

  1. To allow your GameObject to be affected by the Physics system, and react to things like gravity and collisions, add a Rigidbody component.
  2. Use Colliders to enable GameObjects to interact with other GameObjects in the scene. For example, GameObjects with a collider can move or be moved by another GameObject with a collider.
  3. To be able to call a function in code when two GameObjects intersect, add a Collider and make it a trigger.

Back to Top

User Interface

If you want to add a menu or help to your game, you need to set up a user interface. To set up a user interface, use Unity UI.

Back to Top

3D game development quickstart guide
Advanced best practice guides