i am trying to destroy my bullet when it hits a tree in my game but it just will not work. in the same function i am destroying the bullet when it hits the enemy but it will not work on the tree. this is the script im using:
function OnTriggerEnter(other : Collider)
{
if(other.collider.tag == "enemy")
{
Destroy(gameObject);
}
if(other.collider.tag == "tree")
{
Destroy(gameObject);
}
it works for the enemy but not the tree. i have checked the tag many times both the enemy and tree have the same components except for scripts. i am lost as to why this wont work but hopefully someone can shed some light on it?
oh and by the way only the bullet is trigger, iv tried mixing that up but nothing worked.