To display inventory total text for multiple pickups of different object types, follow these steps:
- Start with a new copy of the Simple2Dgame_SpaceGirl mini-game.
- Edit the tags, changing Star to Pickup. Ensure that the star GameObject now has the Pickup tag.
- Add the following C# Script PickUp to the GameObject star in the Hierarchy:
using UnityEngine; using System.Collections; public class PickUp : MonoBehaviour { public string description; }
- In the Inspector, change the description property of component Pick Up (Script) of GameObject star to the text star:
- Select the GameObject star in the Hierarchy panel and make ...