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 - make the ball reappear

  1. Double-click on the DisappearMe Script. UniSciTE or Unitron will open up and display the Script.
  2. Change the word false to true.
  3. Save the Script.
  4. Click on the Play button to test your game.

    Your Script should look like this:

    function Update () {
    renderer.enabled = true;
    }
    

Bingo! The Ball started out invisible and then magically appeared. That means that the Mesh Renderer component and the renderer that we referred to in our Script are the same thing. And the checkbox in the Inspector panel is actually the enabled property in checkbox form instead of true and false, it shows us checked and unchecked states! In fact, you can even keep an eye on the checkbox when you click on Play and see it change states. ...

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