Displaying multiple pickups of different objects as a list of text via a dynamic List<> of scripted PickUp objects
When working with different kinds of pickups, one approach is to use a C# List to maintain a flexible-length data structure of 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 is how the text display of items is generated each time the inventory changes. We 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.

Getting ready
This recipe assumes that you are starting with the Simple2Dgame_SpaceGirl
project we set up in the first recipe in this chapter. The font you need can be found in the 03_02
folder.
How to do it...
To display inventory total text for multiple pickups of different object types, follow these steps:
- Start...