- Home /
desrtoying on collision
im simply trying to have my main game obj( a ship) explode and be destroyed when hit by an enemy bullet, but i apparently cant use the word destroy to do this. i was also trying to get the position of the heroship to reset when your hit
function OnCollisionEnter(col : Collision) { //if(col.gameObject.tag == "enemybullet") //return; //Explode(col.gameObject.transform.position); //ResetPosition(); if(col.gameObject.tag == "enemybullet") { destroy(gameObject== "heroShip"); } }
even with the D in Destroy capitalized i get this message
Assets/Scripts/HeroShip.js(20,24): BCE0023: No appropriate version of 'UnityEngine.Object.Destroy' for the argument list '(boolean)' was found.
You can't use destroy that way. Look at the link I provided.
Your answer
Follow this Question
Related Questions
Scoring (i'm stuck) 3 Answers
Help with collisions and destroy please 1 Answer
How can I remove an object when colliding with an other object? 1 Answer
OnCollisionStay for seconds then destroy 0 Answers