O'Reilly logo

Unity 3D Game Development by Example by Ryan Henson Creighton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.
  2. At the top of the Inspector panel, press and hold on the dropdown labeled Tag, and select Add Tag....
  3. Click on the gray arrow to expand the Tags list near the top of the Tag Manager.
  4. Click in the blank area to the Element 0 label, and type the tag name bomb. Then punch in a tag called stein.
    Time for action - tag the objects
  5. Select the Bomb Prefab again in the Project panel.
  6. In the Inspector ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required