How to do it...

To use panels to visually outline the inventory area and individual items, follow these steps:

  1. Start with a new copy of the Simple2Dgame_SpaceGirl mini-game.
  2. In the Hierarchy panel, create a UI Panel (Create | UI | Panel) and rename it Panel-background.
  3. Let's now position Panel-background at the top of the Game panel, stretching the horizontal width of the canvas. Edit the UI Image's Rect Transform component, and while holding down Shift + Alt (to set pivot and position), choose the top-stretch box.
  1. The panel will still be taking up the whole game window. Now, in the Inspector, change the Height (in the Rect Transform component) of Panel-background to 100.
  2. Add a UI Text object (Create | UI | Text), rename it Text-inventory ...

Get Unity 2018 Cookbook - 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.