Exercise - Position game objects and set visibility
Now let's learn how to create parent objects, add prefabs to the scene, and use the Transform component to place them in particular positions.
Import the tutorial assets
To get started, first download the following Unity custom package: MRTK.HoloLens2.Unity.Tutorials.Assets.GettingStarted.3.0.0.unitypackage
In the Unity menu, select Assets > Import Package > Custom Package....
In Import package, select the MRTK.HoloLens2.Unity.Tutorials.Assets.GettingStarted.3.0.0 unitypackage that you downloaded, and then select Open.
In Import Unity Package, select All to ensure that all the assets will be imported. Then select Import.
Create the parent object
In the Hierarchy window, right-click on an empty spot, and select Create Empty to add an empty object to your scene.
Right-click on the newly created object, select Rename, and change the name to RoverExplorer.
With the RoverExplorer object still selected, in the Inspector window, configure the Transform component as follows:
- Position: X = 0, Y = 0.9, Z = 2
- Rotation: X = 0, Y = 0, Z = 0
- Scale: X = 1, Y = 1, Z = 1
Add the tutorial prefabs
In the Project window, go to the Assets > MRTK.Tutorials.GettingStarted > Prefabs folder.
From the Project window, drag the Table prefab onto the RoverExplorer object, to make it a child of that object. Then, in the Inspector window, configure the table's Transform component as follows:
- Position: X = 0, Y = -0.005, Z = 0
- Rotation: X = 0, Y = 0, Z = 0
- Scale: X = 1.2, Y = 0.01, Z = 1.2
From the Project pane, drag the RoverAssembly prefab onto the RoverExplorer object, to make it a child of that object. Then, in Inspector, configure the Transform component as follows:
- Position: X = -0.1, Y = 0, Z = 0
- Rotation: X = 0, Y = -135, Z = 0
- Scale: X = 1, Y = 1, Z = 1