How to do it...

To display an image, follow these steps:

  1. Create a new Unity 2D project.
  2. Set the Game panel to a 400 x 300 size. Do this by first displaying the Game panel, and then creating a new Resolution in the drop-down menu at the top of the panel. Click the plus symbol at the bottom of this menu, setting Label = Chapter 2, Width = 400, and Height = 300. Click OK and the Game panel should be set to this new resolution:

Alternatively, you can set the default Game panel resolution through menu Edit | Project Settings | Player and then the Resolution and Presentation width and height in the Inspector (having turned off the Full Screen option).
  1. Import the provided Images folder. In the Inspector tab, ensure that the unity_logo image has the Texture Type set to Default. If it has some other type, then choose Default from the drop-down list, and click on the Apply button.
  2. In the Hierarchy panel, add a UI | RawImage GameObject named RawImage-logo to the scene.
  1. Ensure that the RawImage-logo GameObject is selected in the Hierarchy panel. In the Inspector for the RawImage (Script) component, click the file viewer circle icon at the right side of the Texture property, and select image unity_logo, as shown in the following screenshot:

An alternative way of assigning this Texture is to drag the unity_logo image  from your Project folder (Images) into the Raw Image (Script) public property  Texture.
  1. Click on the Set Native Size button to resize the image so it is no longer stretched and distorted.
  2. In Rect Transform, click on the Anchor Presets square icon, which will result in several rows and columns of preset position squares appearing. Hold down Shift + Alt and click on the top row and the center column.
  3. The image will now be positioned neatly at the top of the Game panel, and will be horizontally centered.