How do you destroy the current GameObject? (the one the script is in)
BTW - what is the difference between
Destroy(gameObject) is the correct way to the GameObject your script is attached to.
I'm not sure what you mean by 'on screen'. Prefabs do not exist inside the scene, they are in the project. You should not be destroying Prefabs.
GameObject is a class.
gameObject is a property you can call on a MonoBehaviour to the the GameObject instance that Monobehaviour instance is attached to.
this is the instance of the class the code is in.
answered Dec 27 '10 at 06:30 AM
this gameobject is nothing but in which gameobject you have placed that script...if you use Destroy(this.gameObject);
it'll destroy the gameobject in which you have placed the script....
Destroy(gameObject)- it'll destroy particular gameobject what you have specified.
try to store instantiated gameobject name as "clone" and destroy that clone object using Destroy(clone); it'll destroy all objects from origin.