i am using unity 5.4.2f2 Personal, and i think 5.3 has the same issue.
OnTriggerStay2D do not called every fixedUpdate.
to reproduce, do like below:
(1) two gameObject objA and objB, both with a trigger2D.
(2) put objA and objB close enough so their triggers are overlapped.
(3) add below script to objA:
public class objAControl : MonoBehaviour {
void OnTriggerStay2D(Collider2D coll){
Debug.Log("----OnTriggerStay2D");
}
void FixedUpdate(){
Debug.Log("----FixedUpdate");
}
}
(4) run the scene and see log.
i expect the log is like that:
----FixedUpdate
----OnTriggerStay2D
----FixedUpdate
----OnTriggerStay2D
....
but actually the log is lik this:
----FixedUpdate
----OnTriggerStay2D
----FixedUpdate
----FixedUpdate
----OnTriggerStay2D
....
i mean, sometimes two or more FixedUpdate log near each other and no OnTriggerStay2D between them!
i think this is a bug, because in early version of unity, like unity 5.2.1, no such problem.
i already subimited a bug here: https://fogbugz.unity3d.com/default.asp?849290_d2ha0o2mgkkj1lfa
↧