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 - let's get lazy

There's no need to create an entirely separate script for the stein. Follow these steps to get more bang for your buck out of a single script:

  1. Find the script you called Bomb Script in the Project panel, and rename it FallingObjectScript. Because we'll be using the script more generically, we should give it a more generic name.
  2. In the Project panel, select the Stein Prefab.
  3. Choose Component | Scripts | FallingObjectScript in the menu to attach the script to the Prefab.
  4. In the Inspector panel, you should see that the FallingObjectScript has been added as a Script component to the Stein Prefab.
  5. As we did earlier with the Bomb Prefab, find the Glass Smash Prefab in the Project panel. Click-and-drag it into the prefab ...

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