Time.deltatime Stops Counting

Hey all,
In my script, there is OnCollisionStay function, and it supposed to count to 2 then destroy the object.
But when i check in editor, time only counts for 0.3 then stops.

    private void OnCollisionStay(Collision other)
    {
            if(other.gameObject.name == "egg")
            {
                    collisionTime += Time.deltaTime;
                    if(collisionTime > 1)
                    {
                        Destroy(gameObject);
                    }
            }
    }

When I try with collisionTime > 0.25, it works cause it counts up to 0.3.
Is there anything i’m doing wrong here?

Does OnCollisionEnter reset collisionTime?
Does your body go to sleep and thus stop receiving OnCollisionStay calls?
Does the “egg” move away from the object (do you get an OnCollisionExit)?

Thanks for answer.

Egg doesn’t move away. It just waits on it.
I didnt put any collisionTime reset functions or variables in it.
I think the body didn’t go to sleep, but honestly i didn’t totally understand what is that mean.

Have you added an OnCollisionExit to test this is 100% true? If not, it may be worth trying that.

1 Like

I can add to test it thats good idea.
But i’m definitely sure that egg not leaving.
But i will try it.

very interesting tho