Stop a Rigidbody from exiting collision while touching another collider

I have a player object that moves from side to side. As a temporary floor, I have two cubes lining up next to eachother perfectly. However, when the player moves from one cube to another, the OnCollisionExit function is triggered and the player thinks they are then in the air. I want the player to move from one object to another all while thinking they never left the floor.

I don’t really know how to describe this in any more detail, and I don’t see what code would be required to show, so please ask questions if I’ve missed anything

Thank you for taking a look into my problem!

I would do it with a raycast from the players position down to the ground. That allway returns what kind of object is below the player. If player is “in the air”, no hit is returned by the raycast, so you know the player is falling from your floor-cubes.
Take a look here: Ray cast downward for ground collision - Questions & Answers - Unity Discussions

Another option is to use a static counter value. Every OnCollisionEnter do increase this value by 1. Every OnCollisionExit decreases this value by 1.
As long as the value isn’t zero, you are on the floor.
But I think this is not a very secure method. If one collision is not detected correctely, the value gets wrong.

If your player can’t left the floor in any situation, never ever, you not need to check if the player is on the cubes or not. Then you have to look into your OnCollisionExit code. There must be something that tells the player he left the ground. Delete the lines of code doing this.