Setting up the Game - Text Demo

Tutorial

Beginner

+10XP

20m

Unity Technologies

Setting up the Game - Text Demo

Welcome to Roll-a-ball! In this learning project, you’ll:

  • Use Unity Editor and its built-in capabilities to set up a simple game environment
  • Write your own custom scripts to create the game functionality
  • Create a basic user interface to improve the game experience
  • Build your game, so other people can play it!

Languages available:

1. Overview

In this first Roll-a-ball tutorial, you’ll:

  • Create a new Unity Project
  • Set up your workspace
  • Create and position some basic objects for your game
  • Configure the lighting and game background

By the end of this tutorial, your game will look something like this:

2. Before you begin

You don’t need any previous experience with Unity to complete this learning project, but you do need to install the latest LTS (long term support) version of Unity. This is currently Unity 2020.3 LTS.

New to Unity?

This learning experience assumes that you are already familiar with the Unity Editor. If you’re new to Unity, the Unity Essentials learning pathway has been designed to help you get set up and ready to create in the Unity Editor.

3. Create a new Unity project

Follow the video or text instructions below to select a project template and create a new project:

Download transcript

1. Select a project template

  • Open Unity Hub and log in using your Unity account.
  • Select New Project.
  • Select the 3D (URP) template and then Download template.

2. Create the new project

  • In the Project Settings, set Project Name to “Rollaball” and select a local folder of your choice.
  • Select Create Project and wait for the Unity Editor to open.

4. Create a new Scene

Follow the video or text instructions below to set up your workspace, create a new scene, organize the Project window, and save your scene:

Download Transcript

1. Set up your workspace.

  • Make sure the Default Layout is selected from the Layout dropdown for tutorial consistency.

2. Create a new scene.

  • To create a new scene, select File > New Scene.
  • Select the Basic URP template, then select Create.

3. Organize the Project window

  • Create a new “Template” folder and drag all unneeded folders and files into that folder.

4. Save the Scene

  • Select File > Save As.
  • Name the scene "MiniGame"
  • Save the scene in a new folder named “Scenes”


5. Create a primitive plane

Follow the video or text instructions below to create and a Plane GameObject, reset its position, and then frame the plane in the Scene view:

Download Transcript

1. Create and configure a Plane GameObject.

  • From the main menu, select GameObject > 3D Object > Plane.
  • Alternatively, in the Hierarchy window, select the create menu (+) > 3D Object > Plane.
  • Rename the newly created plane GameObject to "Ground"

2. Reset the position of the Plane.

  • With the Ground selected, select the vertical ellipsis menu (⋮) in the upper right corner of the Inspector window.
  • Select Reset for the Transform component of the Ground GameObject. This action places the GameObject at the origin point (0, 0, 0) in the scene.

3. Frame the plane in the Scene view.

  • Ensure the Ground GameObject is selected, and position the cursor in the Scene view.
  • Press the F key to frame the entire GameObject nicely within the Scene view.
  • Alternatively, select Edit > Frame Selected from the main menu.


6. Scale the Ground Plane

Follow the video or text instructions below to increase the scale of the ground plane and set precise scale values:

Download Transcript

1. Increase the scale of the Ground Plane.

  • With the Ground selected, activate the Scale tool by pressing the hotkey R.
  • Drag the X and Z handles to increase the size of the Plane.

2. Set precise scale values

  • In the Transform component, set the X and Z Scale values to exactly 2.0.

7. Create a Player GameObject

Follow the video or text instructions below to create a sphere for the player, and then position it at the center of the ground plane:

Download Transcript

1. Creating a “Player” sphere.

  • From the hierarchy Create > 3D Object > Sphere.
  • Rename the newly created sphere GameObject to "Player."

2. Position the Player sphere at the origin.

  • In the Inspector window, reset the Transform component of the Player sphere to position it at the origin point (0, 0, 0) of the scene.
  • Press F in the Scene view to Frame the Player sphere in the Scene view.

3. Move the player up to sit on the plane.

  • In theTransform component for the Player sphere, set the Y value to 0.5.

8. Adjust the default lighting

Follow the video or text instructions below to assess the Directional Light, then change its color to white:

Download Transcript

1. Assess the Directional Light.

  • Navigate from the Scene view to the Game view to observe the lighting and shadows on the player GameObject.
  • In the Hierarchy window, select the Directional Light.

2. Change the light color to white.

  • In the Light component, in the Emission fold-out, use the color picker to modify the light's tint from yellow to pure white for better scene balance.
  • In the Color popup window, you can also manually set the RGB values to 255, 255, and 255.


9. Add colors with Materials

Follow the video or text instructions below to create a new Materials folder, a new Background material, a new Player material, and then finally adjust the Directional Light’s rotation::

Download Transcript

1. Create a new “Materials” folder.

  • In the Project window, right-click > Folder to make a new folder.
  • Rename the new folder "Materials".

2. Create a new Background material.

  • In the new Materials folder, right-click > Material to make a new material, then rename it to "Background".
  • In the Inspector, in the Surface Inputs fold-out, select the Base Map color picker.
  • Change the color to a pale gray with RGB values of 130, 130, and 130.
  • Make sure the Metallic Map is set to 0 and the Smoothness is set to around 0.25 for a matte finish.
  • Apply the Background material to the Ground plane by dragging it from the Project window onto the plane in the Scene view.

3. Creating a new Player Material.

  • Create another material named "Player" within the Project window.
  • In the Inspector, adjust the Base Map color for the Player material — set the RGB values to 0, 220, and 255 for a light blue.
  • Set the Metallic Map to 0 and change Smoothness to 0.75 for a shiny finish.
  • Apply the Player material to the player sphere by dragging it onto the sphere in the Scene view.

4. Change the Directional Light’s rotation.

  • In the Hierarchy, select the Directional Light.
  • In the Transform component, change the rotation values to X=50, Y=50, and Z=0 for a more dramatic silhouette.

Complete this Tutorial