OnTriggerStay Doesn't work if not moving

Hello,


if I instantiate a sphere with a trigger collider “inside” of a wall, it doesn’t happen what is supposed to happen.

If I instantiate the sphere outside of the wall and move it into the wall, it works.

Why, and how can I solve it?

I know I am way too late for this… but just in case anyone stumbles upon the same problem here’s what worked for me.

I solved it by calling the rigidbody and applying a foce of zero to it inside the void Update, that way it won’t go to sleep.

In my case was for a 2D game so it ended up looking like this:

Rigidbody2D rb;

// Update is called once per frame
    void Update()
    {
        rb.AddForce(Vector2.zero);
    }

I bet there’s better ways to do this but this one is really simple and works for a fast and easy fix.

Review all the conditions on the Rigidbody Sleeping page. Are your objects set up correctly with rigidbodies or static colliders? Given your description, the sphere should probably be a static collider marked Is Trigger, and the sphere should have a rigidbody.

If you instantiate one collider inside another, it will not register OnTriggerEnter messages, but it should register OnTriggerStay.