Box Collider not working without Gravity

I have my player controller sitting on a plane and a boundary around of box colliders. The box colliders werent working as the player controller could just pass straight through. I looked at many other questions on here to make sure I was doing everything right (making sure ‘is trigger’ is unchecked, having at least one with rigidBody etc) and I couldn’t figure it out. Finally, I worked out that I needed to turn gravity modifier from 0 to 1 for it to work. I don’t know why this is.

I want to eventually be able to move freely inside an enclosed space (i.e. no gravity and 4 walls, a roof and a floor as box colliders acting as the game boundary). How do I get my colliders to work without gravity???

Colliders don’t care about gravity. Turning gravity on/off won’t make a collider stop or start working. If it did for you, it’s just a fluke.

You’re probably moving in a non-physics-system way, that ignores colliders. For example, using transform.translate. Adding gravity tells the physics system to move the object (down,) which will hit and stop on colliders. But your movement is probably still wrong, and will continue to go right through colliders.

There are several Qs here about movement going through everything, and ways to move (charControllers, physics+AddForce.)