Examples
Now let’s jump into some examples! We’ll be creating a layout for a basic heads-up-display (HUD) and a background image that stretches with the screen and scales at multiple resolutions.
Before we begin building our UI, let’s set up our project and bring in the art assets we will need.
We’ll begin by setting up our project:
- Create a new Unity Project and name it
Mastering Unity UI Project
. Create it in the 2D mode.
Note
We’re selecting 2D Mode because it will make importing our UI sprites a lot easier. When in 2D Mode, all images import as Sprite (2D and UI) images rather than Texture images, as they do in 3D Mode. You can change to 3D Mode at any time by navigating to Edit | Project Settings | Editor and changing Mode to 3D.
- Create two new folders within the
Assets
folder namedScripts
andSprites
. - Create a new scene and name it
Chapter6.unity
; ensure that you save it in theScenes
folder. You could also...