I have a weird problem that happened yesterday (probably the first time I tried to run this project with 5.1.3), but I didn’t change anything in the source code, didn’t manipulate the involved prefabs nor layer settings.
Take a look at this piece of code:
public class SawCollider : MonoBehaviour {
Saw parent;
bool isKilling;
void Awake() {
parent = GetComponentInParent<Saw>();
}
void OnTriggerEnter(Collider collider) {
Debug.Log(Time.time + ": enter -> " + collider); //works
}
void OnTriggerExit(Collider collider) {
Debug.Log(Time.time + ": exit -> " + collider); //works
}
void OnTriggerStay(Collider collider) {
Debug.Log(Time.time + ": stay -> " + collider); //doesn't work, but worked yesterday
parent.HurtCollider(collider);
}
}
Now the problem is that the OnTriggerStay function worked perfectly well all the time, but yesterday it just suddenly stopped working in 5.1.3 (updating to 5.2 didn’t help). My co-worker, with Unity 5.1.0f3, didn’t notice the problem (it works on his machine). According to docs, my OnTriggerStay function should work (all interacting objects have rigidbodies attached). The OnTriggerEnter/Exit functions (that I added today to test if physical layers are visible to each other) work like a charm too.
Here’s a log, so you can see that the difference between OnTriggerEnter and OnTriggerExit can be as high as a few seconds, so Unity should call OnTriggerStay certailny more than 0 times:

So, what’s wrong with it? An Unity bug? Out-of-date docs? Because really, I didn’t change anything, it just stopped working on my machine. I tried to test ancient revisions too (the ones where I created the saw and tested it) with no success - it doesn’t work in those as well.
Note that I don’t need a work-around solution for this, as it’s not difficult to write, I just only want to know why it stopped working.
Update: my friend updated Unity to 5.2 and it messed up the saws as well.
Update 2: Unity team answered that they’re already working on fixing this issue. Unity Issue Tracker - [TriggerCollider] OnTriggerStay is not called for child objects