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.
Popularity: 1% [?]
Rate this Post:



Email This Post
