For some reason, when this script works as intended (Makes “Detonator” explode from the explosion framework plugin on contact with another object), Unity freezes. This is the script I used:
function OnTriggerEnter (other : Collider) {
gameObject.GetComponent("Detonator").Explode();
yield WaitForSeconds(2);
Destroy(this.gameObject);
}
The object that I have this script attached to does not have a detonator on it at all, but it still makes the explosion beforeit freezes. Removing the “gameObject.GetComponent(“Detonator”).Explode();” from the script fixes it, but I need the explosion to happen.
Do you need the object that has the code above to explode, or do you want the colliding object to explode?
– mattssononI want the explosion to emit from the object that has this script (It is a missile).
– XMatrix2XThen why doesn't it have the Detonator script? It seems like that's the script making an object explode.
– mattssononHaving a detonator or not seems to have no effect on what happens. I think that when I call the component "Detonator", it pulls "Explode" from the script in my assets, not the detonator on it.
– XMatrix2XIf your detonator script is derived from monobehavior than it's highly unlikable. Did you try my answer?
– gajdot