- Home /
The question is answered, right answer was accepted
OnTriggerEnter works on Unity Editor but not in android device?
Why OnTriggerEnter works in the editor but not in a phone?I'm using unity 5.3
Could you give us either a screen shot or a snippet of your code? This is not enough information for somebody to help you out.
void OnTriggerEnter(Collider col) {
{
if (col.gameObject.tag == "pointlight")
{
Destroy (col.gameObject);
}
}
I have this attached to the Player..player has a rigidbody and a collider
Hmm.. Okay, nothing wrong there.
What about at the top of your script, do you have using UnityEditor; ins$$anonymous$$d of using UnityEngine?? That could cause it to only work in the editor and not in the engine.
Or, are there any of your objects' tags "EditorOnly"? This can also cause stuff to work in the editor, but not a build.
Fixed!It was only that I used two different projects and the tags weren't registered .. Thanks ;)
i have the same question. The collision worked fine on the game view in unity, but it does not work on android and ios.
if u find the way to fix it, plz tell me, thanks
They have fixed it - see the comment 3 days ago that says "Fixed!"