- Home /
Question by
BraydenYates · Apr 03, 2013 at 06:42 PM ·
gameobjectdestroyoncollisionenter
Script Error : On Collision Enter - I need a solution.
Hello, I have a script which is below. when I use it, it does not work. I used a debug.log on the first two lines and it worked. My projectile is named "Bullet" and the target is "Mob" Any help would be great.
SCRIPT:
function OnCollisionEnter(other: Collider){
if(other.tag == "Mob"){
Destroy(other.gameObject);
}
}
Comment
Answer by whydoidoit · Apr 03, 2013 at 06:44 PM
OnCollisionEnter takes a Collision as a parameter and not a Collider, OnTriggerEnter does take a Collider.