Time for action – tag the objects

As we saw before with our bouncing heart, we can tag objects in the Scene, and then refer to objects in code using their tag names. Let's tag the bomb and the stein so that the player character can tell what hit him.

  1. Select the Bomb Prefab in the Project panel. (You can actually select anything in this step. We're not actually applying a tag—just creating one. But we need to select something so that we see the tag interface show up in the Inspector panel. You can also reach it by navigating to Edit | Project Settings | Tags in the Unity menu.)
  2. At the top of the Inspector panel, press and hold on the drop-down labeled Tag, and select Add Tag….
  3. Click on the gray arrow to expand the Tags list near the top of the TagManager ...

Get Unity 4.x Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.