I have a gameobject(cube) in my scene.
I want to be able to click on the gameobject and automaticaly destroy the gameobject so i wont be able to see it on my screen.
What script i have to attache on my gameobject??
asked Dec 02 '10 at 11:54 PM
the cube should have a collider, and the script i thionk you want is when you click on the cube, it's destroyed forever. until you play the scene again.
here it is:
that should work.
right! also, this script goes on the object(s) you want to destory.
Hey! I think this URL can help you http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.OnMouseDown.html Hope i helped ;)
This script will destroy the gameobject when you click:
And this script, will give you an idea of how to do what you asked... (I am not posting this whole script, so you can learn, and answer these questions yourself)
-Hope I helped
answered Dec 03 '10 at 12:14 AM