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.