The build up is over; we are finally here: creating the action scene where the players bravely catch the monster. Also, this will be our introduction to incorporating AR into our game. There is lots to do to get this all completed by the end of the chapter, so let's get going. We will start by creating a new Catch scene:
Catch
and click on the Save button.CatchScene
and reset its transform to zero in the Inspector window.Main Camera
and Directional Light
objects on to the CatchScene
object, to reparent them.Canvas
object with the Raw Image
as a child. Select and rename the RawImage
object to Camera_Backdrop
in the Inspector window.Camera_Backdrop
selected in the Inspector window, set the Anchor Presets to stretch-stretch, by clicking on the Anchors icon to display the menu. Then, hold down the set pivot and set position keys when making the bottom-right corner selection, as follows:
Setting anchor presets on UI element
Canvas
object onto the CatchScene
object.
Canvas
object. In the Inspector window, locate the Canvas component. Change the Render Mode to Screen Space - Camera. Then, drag and drop the Main Camera object from the Hierarchy window onto the open Render Camera slot on the Canvas component; refer to the following screenshot for the proper settings:
Canvas component settings for Screen Space - Camera
The difference between render modes Screen Space - Overlay and Screen Space - Camera is the positioning of the render plane. In the Overlay mode, all the UI elements are rendered in front of everything else in the scene. Whereas, in the Camera mode, a UI plane is created a fixed distance away from the camera. This way, world objects can be rendered in front of the UI elements.
Canvas
object still selected, change the UI Scale Mode in the Canvas Scaler component to Scale with Screen Size in the Inspector window, as follows:
Settings for Canvas Scaler component
EventSystem
object. We won't need it here, and even if we do, Unity will create one for us. Finally, save the scene.That completes the base Catch scene. Time to move on to the world of AR.
3.144.238.20