Change direction when the object is in the center

Hello!
I want to make that grey colored cube to change direction to the left, when the cube arrives to the corner.
How can i make it?

Hello,

Did you try some solutions before posting here ?

There are several ways to do this, but the more obvious to me is usiing triggers.

This is the tutorial to create colliders as triggers.

This is the documentation about collisions methods.