Home > Blog > Turn Something Invisible in Unity 3D

Turn Something Invisible in Unity 3D

thing.renderer.enabled = true; // or false

… where “thing” is a reference to a GameObject.

If you’re doing this in a script that’s attached to the GameObject you want to hide, try:

gameObject.renderer.enabled = false;

Note that the GameObject’s collider is still active, so the GameObject can still be clicked on, run into, etc. Here’s a fast way to make the GameObject’s collider inactive:

gameObject.collider.isTrigger = true;

To disable the GameObject’s clickability, do this:

gameObject.active = false;

Ryan Henson Creighton is a Toronto-based game developer, and founder of Untold Entertainment Inc., specializing in online games for kids, teens, tweens and preschoolers.
Ryan Henson Creighton
Ryan Henson Creighton
View all posts by Ryan Henson Creighton

Popularity: 1% [?]

Rate this Post:
1 Star2 Stars3 Stars4 Stars5 Stars (Not Yet Rated)
Loading ... Loading ...
                      

                                 
 

Leave a Reply