Displaying an image
There are many cases where we wish to display an image onscreen, including logos, maps, icons, and splash graphics. In this recipe, we will display an image centered at the top of the screen.
The following screenshot shows Unity displaying an image:
Figure 1.11: Displaying the Unity logo as an image
Getting ready
For this recipe, we have prepared the image that you need in a folder named Images in the 01_06
folder.
How to do it...
To display an image, follow these steps:
- Create a new Unity 2D project.
- Set the Game panel to 400 x 300. Do this by displaying the Game panel, and then creating a new Resolution in the Free Aspect drop-down menu at the top of the panel.
- Click the plus (+) symbol at the bottom of this menu, setting Label to Core UI, Width to 400, and Height to 300. Click OK; the Game panel should be set to this new resolution:
Figure 1.12: Adding a new screen resolution to the Game panel
...