Skip to main content

Step 2: Creation of the Unity basic game

๐Ÿ“‹ Prerequisitesโ€‹

Before starting this tutorial, please ensure:


๐Ÿš€ A. Project Setupโ€‹

1. Import the Templateโ€‹

To start the game creation process, first clone or download the Simple Unity Template.

  1. Unzip the archive.
  2. Open Unity Hub.
  3. Click the Add button and select the unzipped Unity Template folder.
Unity Hub Add Project
  1. Once imported, click on the project name in the list to launch it.

๐ŸŽฌ B. Scene Configurationโ€‹

Once the project is open, the first step is to create a specific scene for the simulation.

1. Create the Sceneโ€‹

We want to establish a "decision maker" view from the sky. We will use a specific template for this.

  1. Go to File > New Scene (or press Ctrl+N / Cmd+N). New Scene
  2. Select the "Main Scene - Sky View Player" template. Main Scene - Sky View Player
  3. Click Create.
  4. Save your current scene immediately (File > Save).

2. Verification: Scene Loadingโ€‹

[!WARNING] Sometimes, Unity may not load all references correctly upon scene creation.

How to detect a loading error: You might encounter one of the two following issues immediately after creating the scene:

  1. Console Error: A red error appears: NullReferenceException: Object reference not set to an instance of an object. Console Error
  2. Missing References: If you select the Manager object in the Hierarchy, the Player and Ground fields in the Inspector show as "None" or empty. Missing References

To fix this issue:

  1. Go to the Console tab and click Clear.
  2. Open a different scene (e.g., Assets/Scenes/Code Examples/Limit Player Movement).
  3. Re-open your newly created scene.
  4. The error should disappear, and the Manager references should now be correctly assigned.

3. Configuration: Middleware Connectionโ€‹

Once the scene is loaded correctly, you must verify the external connection settings.

  1. Select the Manager object in the Hierarchy.
  2. Locate the Connection Manager component in the Inspector.
  3. Crucial: Ensure that the Fixed Properties checkbox is enabled.

[!CAUTION] If Fixed Properties is not checked, the connection to the middleware will not function correctly.

Fixed Properties

4. Troubleshooting: Lighting Warningโ€‹

You may see a yellow warning in the Console stating:

"Lighting data asset 'LightingData' is incompatible with the current Unity version..."

To fix this:

  1. Go to Window > Rendering > Lighting. Lighting Menu
  2. In the Lighting window, click Generate Lighting. Generate Lighting
  3. Wait for the process to finish, then Clear the Console.

โš™๏ธ C. Gameplay Configurationโ€‹

1. Game Manager: Tag Configurationโ€‹

Crucial Step: Tags sent by the model must be explicitly defined in Unity to avoid synchronization issues.

To define a new tag:

  1. Select any Game Object.
  2. In the Inspector, click the Tag dropdown > Add Tag...
  3. Click + and type the tag name.

[!NOTE] For this tutorial, please add a new tag named "road" (case-sensitive).

Add Tag Road Tag

2. SkyViewPlayer Configurationโ€‹

We will use the SkyViewPlayer prefab. To improve navigation speed:

  1. In the Hierarchy, expand SkyViewPlayer.
  2. Select the child object named Locomotion.
  3. In the Inspector, update the script values:
    • Move Vertical Speed: 20
    • Move Horizontal Speed: 20
    • Rotation Speed: 10
Locomotion Settings

๐ŸŽฎ D. Testing the Modelโ€‹

You can run the simulation in two ways:

  1. VR Headset: Build and deploy to the device.
  2. Unity Editor (Play Mode): Runs directly on your computer.

[!IMPORTANT] Simulator Requirement To control the player movements within the Unity Editor (Play Mode), you must use a Simulator. Note that on some platforms (like macOS), you may need to manually set it up.

๐Ÿ‘‰ Please follow the instructions in the Running a Model Game guide to properly set up the simulator.


โžก๏ธ Next Step: Proceed to Step 3