Question by
chumther47 · Oct 18, 2016 at 06:17 AM ·
iosontriggerenterapple
OnTriggerEnter won't work after iOS build
I have a simple code where when a bullet hits an object, it does damage and it gets destroyed. It works perfectly in the Unity editor, but when I build and install on an iOS device, it won't work. Everything else seems to work fine.
here is the code: public class BulletDamage : MonoBehaviour {
void Start()
{
}
void OnTriggerEnter(Collider other)
{
if (other.tag == "EnemyBoss")
{
other.GetComponent<EnemyHealth> ().DoDamage (5);
Destroy(gameObject);
}
}
}
Comment
Answer by danivdwerf · Oct 18, 2016 at 07:47 AM
I don't know about any bugs, but maybe check some stuff (just to be sure)
Does the boss have the tag? Does one of the two colliders have a Rigidbody component? Do you not have warnings or errors about this script? Is the script assigned to the right object?
From web developing I have learned that somethings do work locally but do not work online, it's really messed up.
Good luck man!
Your answer
![](https://koobas.hobune.stream/wayback/20220612094852im_/https://answers.unity.com/themes/thub/images/avi.jpg)