|
Right, I have a script that does various things depending on what the collider hits. To check that the collider hit the right object before it does anything i'm using: if(hit.gameObject.tag == "donkey") { } It all works 100% when it hits the object with that tag but if it hits an object with a different tag it throws off this error: UnityException: GameObject has undefined tag! Any help would be much appreciated!
(comments are locked)
|
|
It seems like he's using OnControllerColliderHit(hit : ControllerColliderHit). But either way you change it to if(hit.gameObject.tag == ("donkey")) after that it should work just fine
(comments are locked)
|
|
Just ran into this problem. This seems to have worked:
(comments are locked)
|

Is hit in fact a RaycastHit? If so, that really shouldn't work at all.
We would really need to see a bit more of the code to help out. What is "hit"? If you can post the whole function, that would help us help you a lot