Often, the simplest inventory situation is to display text to tell players whether they are carrying a single item (or not). In this recipe, we'll add the ability to detect collisions with the star GameObject and add this to the SpaceGirl mini-game. We will also display an on-screen message stating whether a star has been collected or not:
Figure 3.6 – Example of text for displaying single-object pickups
At the end of the recipe, in the There's more... section, we'll learn how to adapt this recipe to maintain the Integer total for how many stars have been collected, for a version of the game with lots of stars to collect.