Colliding without passing through it

Is there a way to check collision without passing through the object that you collide?

Theres different ways to do this, but the most simple one would be to attach a Rigidbody component and adjust your controller to work with rigidbody movement