I have two objects: a ball with a rigidbody and a sphere collider, and the level with a mesh collider. As the ball moves around I want to use OnCollisionStay to detect whether the ball is on the ground, wall, or ceiling of the level, and OnCollisionExit to detect when it is airborne. The problem is that neither function gets called until about ten seconds into running the game. OnCollisionEnter, however, starts working immediately. Why is this delay happening?

Edit:

I made a whole new project to test this. Here’s my code. All it does is break when either event occurs.

using UnityEngine;
using System.Collections;

public class ballcontroller : MonoBehaviour {

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}

    void OnCollisionStay(Collision collision)
    {
        Debug.Break();
    }

    void OnCollisionExit(Collision collision)
    {
        Debug.Break();
    }
}

And here’s a picture of the scene.

And here’s where it actually breaks. This happens after about tens seconds of the ball just rolling back and forth on the mesh.

http://unity3d.com/support/documentation/Components/RigidbodySleeping.html

This maybe? I’m not to sure on this one.

Have you by chance been fiddling with your TimeManager settings? Doing so can cause some undesired behavior if you rely on rapidly updating colliders.

If that’s not your issue, you might check the Unity manual page on script execution order and make sure that isn’t causing problems for you – whether based on some race condition within your own scripts, or because Unity’s internals aren’t ticking in the order you expected.

Figured it out. It happens when using .blend files with generated mesh colliders. Exporting to collada causes everything to work as expected.