- Home /
Destroy fireball on impact
Ive seen this question answered a few times and ive tried editing my script but im pretty new to this and im not sure what im doing wrong. Everything else works in this script with the detonate on collision, everything except destroying the object after the detonate it simply bounces around.
var explosion : GameObject;
function Update () {
}
function OnCollisionEnter(collision : Collision){
var explosionClone = Instantiate(explosion,transform.position, transform.rotation);
explosionClone.GetComponet("Detonator").Explode();
Destroy(gameObject);
}
hi, try destoying the explosionClone Gameobject ins$$anonymous$$d of this.gameobject
Tried that out but I am getting this error now, $$anonymous$$issing$$anonymous$$ethodException: $$anonymous$$ethod not found: 'UnityEngine.GameObject.GetComponet'.
Just for reference my last line now looks like this
Destroy(explosionClone.Gameobject);
Typo error, it should be:
explosionClone.GetComponent("Detonator").Explode();
oh my god, thank you i should have double checked that was so sure it was a error in my script. thanks again for your guy's help!
Your answer
Follow this Question
Related Questions
Fireball Script not moving in a straight line 3 Answers
How can I delay the cast of a fireball as well as destroy a gameobject mid script 2 Answers
Meteor Explosion, Destroy on Impact 2 Answers
using Contains(gameObject) to find and destroy a gameObject from a list 2 Answers
Getting all Object to go next scene. 1 Answer