Creating a C# inventory slot UI display scripted component
In the previous recipe, we started to work with UI panels and images to create a more general-purpose GameObject for displaying inventory slots, and images to indicate what is stored in them. In this recipe, we look at taking things a little further with the graphics, and also create a C# script class to work with each inventory slot object.

As we can see in the screenshot, in this recipe we'll create the UI (and scripts) for an inventory that has three locations for stars, and three more for keys, using colored and gray icons to indicate how many have been collected.
Getting ready
This recipe adapts the previous one. So, make a copy of the project for the previous recipe and work on this copy.
For this recipe, we have prepared a folder named _Scripts
in the 03_06
folder.
How to do it...
To create a C# inventory slot display script component, follow these steps:
- Import the
_Scripts
folder from the provided files (this contains a copy of...