var explosion : Transform;
function OnTriggerEnter (collision : Collider){
Instantiate(explosion, transform.position, Quaternion.identity);
Destroy(gameObject, 0.5);
}
It has Destroy option and it won’t work, any ideas why? Thanks!
var explosion : Transform;
function OnTriggerEnter (collision : Collider){
Instantiate(explosion, transform.position, Quaternion.identity);
Destroy(gameObject, 0.5);
}
It has Destroy option and it won’t work, any ideas why? Thanks!
You are destroying the gameObject where that script is attached (not the instantiated gameObject).
Destroy(gameObject.collision);
this will destroy what has collided with, if this script is the thing that makes particles then do the same thing that you did, except remove the 0.5
Almost, good sir.
Destroy(collision.gameObject);
You’re assuming he wants the gameObject to destroy immediately.
You’re also assuming he wants to destroy the colliding object, rather than the gameObject, or the explosion.
OP’s fault, but making assumptions is dumb.