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 the PlayerInventory script class from one of the previous recipes, which we can use unchanged for this recipe).
- Delete two of the three inventory slot GameObjects – that is, Panel-inventory-slot (1) and Panel-inventory-slot (2) – so that only Panel-inventory-slot remains.
- First, we'll create a panel for three star slots. In the Hierarchy window, create a UI Panel (Create | UI | Panel) and rename it Panel-stars.
- We'll now position Panel-stars at the top-left of the Game window and make it fit within the left-hand side of our general inventory rectangle. Edit the UI Image's Rect Transform component and, while holding down Shift + Alt (to set its pivot and position), choose the top-left box. Now, set Width to 300 and Height...