Start Your Engines
In this lesson, you will create your very first game project in Unity Hub. You will choose and position a vehicle for the player to drive and an obstacle for them to hit or avoid. You will also set up a camera for the player to see through, giving them a perfect view of the scene. Throughout this process, you will learn to navigate the Unity Editor and grow comfortable moving around in 3D Space. Lastly, you will customize your own window layout for the Unity Editor.
Project Outcome:
You will have a vehicle and obstacle positioned on the road and the camera set up perfectly behind the vehicle. You will also have a new custom Unity layout, perfectly optimized for editing.
Project Outcome:
You will have a vehicle and obstacle positioned on the road and the camera set up perfectly behind the vehicle. You will also have a new custom Unity layout, perfectly optimized for editing.
Video
Introduction
Make a course folder and new project
- On your desktop (or somewhere else you will remember), Right-click > create New Folder, then name it “Create with Code”
- Open Unity Hub and select the Projects tab from the left sidebar
- Select New to create a new project, using one of the supported versions of Unity (2018.4LTS, 2019.4LTS, or 2021.3LTS)
- Select the 3D template, name the project “Prototype 1”, and set the location to the new “Create with Code” folder
- Select Create, then wait for Unity to open your new project
Opening the project
- Click to download the Prototype 1 Starter Files, then extract the compressed folder. Windows: Right-click on the file > Extract All Mac: Double-click on the file
- From the top menu in Unity, select Assets > Import Package > Custom Package, then navigate to the folder you extracted and select the Prototype-1_Starter-Files.unitypackage file.
- In the Import Unity Package window that pops up, select Import and wait for the assets to import.
- In the Project window, in Assets > Scenes > double-click on the Prototype 1 scene to open it
- Delete the Sample Scene without saving
- Right-click + drag to look around at the start of the road
Adding the vehicle to your scene
- In the Project Window, open Assets > Course Library > Vehicles, then drag a vehicle into the Hierarchy
- Hold right-click + WASD to fly to the vehicle, then try to rotate around it
- With the vehicle selected and your mouse in the Scene view, Press F to focus on it
- Use the scroll wheel to zoom in and out and hold the scroll wheel to pan
- Hold alt+left-click to rotate around the focal point or hold alt+right-click to zoom in and out
- If anything goes wrong, press Ctrl/Cmd+Z to Undo until it’s fixed
Adding the obstacle and repositioning it
- Go to Course Library > Obstacles and drag an obstacle directly into the Scene view
- In the Inspector for your obstacle, in the top-right of the Transform component, click the more options button > Reset Position Note: The more options button may appear as three vertical dots or a gear icon, depending on your version of Unity
- In the Inspector, change the XYZ Location to x=0, y=0, z=25
- In the Hierarchy, Right-click > Rename your two objects as “Vehicle” and “Obstacle”
Locate your camera and run the game
- Select the Camera in the hierarchy, then press F to focus on it
- Press the Play button to run your Game, then press Play again to stop it
Move the camera behind the vehicle
- Use the Move and Rotate tools to move the camera behind the vehicle looking down on it
- Hold Ctrl/Cmd to move the camera by whole units
Customize the interface layout
- In the top-right corner, change the layout from “Default” to “Tall”,
- Move Game view beneath Scene view
- In the Project window, click on the little drop-down menu in the top-right and choose “One-column layout”
- In the layout Dropdown, save a new Layout and call it “My Layout”