When working with different kinds of pickups, one approach is to use a C# List to maintain a flexible-length data structure containing the items currently in the inventory. In this recipe, we will show you how, each time an item is picked up, a new object is added to such a List collection. An iteration through the List will show how the text display for items is generated each time the inventory changes. Here, we will introduce a very simple PickUp script class, demonstrating how information about a pickup can be stored in a scripted component, extracted upon collision, and stored in our List:
![](https://static.packt-cdn.com/products/9781839217616/graphics/assets/a41501bf-bbb7-49a1-8b8d-7aa6ae7b113f.png)
Figure 3.33 – Example of the UI displaying multiple pickups of different objects