Adding the cherry UI components

In this section, we will add an image of cherries and a text object for displaying the number of cherries the Cucumber Man has.

We will start by adding the cherry image:

  1. Download the Cherries.png file from the publisher's website
  2. Drag that image into the Assets | Cherry folder in the Project panel
  3. Select the imported image and, in the Inspector panel, change the Texture Type to Sprite (2D and UI)

 

  1. In the Hierarchy panel, right-click the HUD_Canvas and select UI | Image
  2. In the Inspector panel, click the small circle to the right of the setting under Image (Script) | Source Image
  3. Select the Cherries.png image you added in step 2
  4. In the Inspector panel, rename this as Cherries
  5. Click  Rect Transform | Scale ...

Get Getting Started with Unity 2018 - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.