OnCollisionEnter is not working properly

I’ve a cube and 2 roads which they stand side by side (for instance asphalt and pedestrian) I want to handle whether the cube is on asphalt or not. It’s working only if the cube stands fully on one of them. If it stands on both at the same time and take it back onto asphalt it keeps acting as if it’s on pedestrian. Why?

Try using OnCollisionStay. That way it’s constantly checking what it’s standing on. I find sometimes using OnCollisionEnter, there is a possibility it may miss a frame. Short of that, what is your actual code in the OnCollisionEnter function?

Assuming you are testing OnCollisionEnter on the cube, the function can test one collision at a time. Even though the cube is standing on both asphalt and pedestrian, it must be testing pedestrian collision first.