Issues with rigidbody, boxcollider, and gravity in a 2d top down game

First of all, forgive me as I am very new to all of this.

I have been following an online tutorial for a top-down zelda-like game. The player’s gameobject has a rigidbody2D with a body type of dynamic and a boxcollider2D. Since the game is top-down I need gravity turned off. I have turned y-axis gravity to 0 under edit > project settings > physics, as well as under edit > project settings > physics 2D. I have also set the rigidbody of the character to gravity 0 as well. I have even tried hard-coding a zero gravity into the character’s movement model, using Physics2D.gravity = Vector2.zero, Physics2D.gravity = Vector3.zero, Physics.gravity = Vector2.zero, and Physics.gravity = Vector3.zero. Even after all this, the character rockets towards the bottom of the screen when I hit the play button. The only thing that stops this behavior is turning off the boxcollider 2d, setting the boxcollider2d to “is trigger” or setting the rigidbody to kinematic. While all of these solutions make my movement model work fine, none are really useful since they prevent me from actually using colliders to restrict the player’s movement to within the scene. Does anybody have any idea what could be going on? Why is the boxcollider2D forcing my player’s gravity back on? Is there a way to stop this, or is there a Kinematic body type workaround? Attached are a couple images, the first shows my game running, the main character already having fell off the scene, the dynamic body type, and the zero gravity. The second image shows the game running, nothing has been changed except that the box collider has been turned off. As I said, similarly, if the box collider is set to “is trigger” or if the rigidbody is set to kinematic, the character stays on screen and my movement model works wonderfully. Unless there is a workaround however, I need a dynamic rigidbody, and some way to turn off the gravity even moreso than I already have.
Any help is greatly appreciated.


For anybody having a similar problem, I think I’ve finally figured out what was wrong. After rebuilding the scene from scratch, I noticed that this problem only occurred again once I’d placed more than one boxcollider2D on the RoomParent object that I had created to hold my room template objects. (I was unaware at the time that you can’t have more than one boxCollider2D on a given GameObject at a time) I can’t explain why it works this way, perhaps someone more experienced than I can, but once I put a CompoundCollider2D on my object, everything started working nicely. Hopefully if anyone else out there runs into this problem, they can find it here! And if you feel you can elaborate or shed more light on my mistake I’d be happy to learn more!