- Home /
How Do I deActivate One Sphere ?
I have three Spheres in a scene. I want two to be active and one to be deactive...I want the Sphere to remain visible in the scene but I just don't want it to do anything...I want to just turn it off so it sits there and does nothing. But I can't quite figure out how to do it? Maybe I have the syntax wrong? Or maybe it's something else. I have --
Sphere (1)
Sphere (2)
Sphere (3)
I've tried all sorts of stuff like Sphere(1).SetActive(false); I've used GameObject and gameObject and included and () and all sorts of combinations of these but I just can't quite get the right command. Maybe it can't be done...but my guess is that I just don't know what I'm doing.
Answer by Nova-1504 · Nov 24, 2016 at 09:26 PM
Use the Destroy.component function. It's simple and does exactly what you're describing.
Thank you. That does about the same thing as gameObject.SetActive(false); in that the objects will disappear from the scene if I have the script attached to the object. But it always gets rid of the object that the script is attached to.
I'd like to be able to select the item that I want to disable/inactivate and even change it from scene to scene and I would like for it to remain visible. I don't know how to selectively disable one of the spheres.
I appreciate you taking the time to help me but it's not exactly what I'm looking for. I'm sorry that I wasn't clear.
Not really a comment, but I'm going through those beginner and intermediate tutorials that you referred to. That's what prompted the question. After seeing one of the later tutorials, it was something that I thought would be useful in one of my programs but I couldn't quite figure out how to do it.
I've already gone through the beginner tutorials previously but at that time I was a total 100% Unity noob and I didn't understand most of what I watched.
The "beginning" stuff is a lot clearer this time but I can tell I still have a long ways to go to really understand Unity.
Thanks. I have to watch these tutorials more than once. Some of you guys might have to watch them only once. I'm an old guy and I'm not that fast. I must watch them (after which most of it is still confusing) and them do some stuff and watch them again and them watch some other tutorials and so some stuff and then I STILL must often go back and watch them again.
Some of those tutorials, I've watched three or four times already. And I'll probably still need to watch some of them again.
I'm slow I suppose. :)