Building the UI
At this point, we want to give the user the ability to clear a scene and turn off the planes. The planes are helpful to identify surfaces we can drop objects onto, but they really distract from the experience. We will do this by building a dead simple UI with a couple of buttons. Fortunately, Unity has a very powerful UI system called uGUI, which will allow us to quickly do this. Open up the Unity editor to the Main
scene and follow along:
- Click on an open area of the
Hierarchy
window to ensure that your selection is cleared. We do this to avoid attaching objects to other objects mistakenly. - From the menu, select
GameObject
|UI
|Canvas
. Name the new object asUI
and ensure that the properties for this object match theInspector
window in the following excerpt:
Setting the properties of a new UI canvas
- The settings we use on this
Canvas
allow our childUI
objects to scale automatically with screen size based on a specific resolution. If we didn't do this, ourUI
controls would...