So I’ve got a movement script, and I have a Rigidbody2D. I did a descent amount of testing (not really) and found that it’s not the movement script that’s the problem, as it happens with other scripts (for movement). I also have a script for the pause menu, which - among other things - disables the player movement script when the pause menu is turned on, and turns it back on when the menu is turned off.
This also isn’t the problem, as that’s all it does with the player’s movement. However it may somehow be bypassing the issue, because when I try to disable and re-enable the script manually (while the game is running), nothing happens. Whereas when I open the menu, and close it, the rigidbody drops to the ground and I can control it.
I tried doing the following to pinpoint the issue, and fix it:
- Disable the pause menu script.
- Change the “Sleeping Mode” of the Rigidbody2D to “Never Sleep” instead of “Start Awake”.
- Enable the movement script in the pause menu script, inside both “Awake” and “Start” (separately, and then together).
- Reset the Rigidbody2D, as I have been playing with some settings, and wanted to make sure it wasn’t me breaking stuff.
I have not messed around with any of the “Physics 2D” settings in the project options, other than decreasing the “Default Contact Offset” as much as possible (because there was a tiny, empty line between colliding sprites). I reset that too, but it didn’t fix anything.
There is nothing currently at the same z value as the player, although that shouldn’t affect sprites. I checked actually, and it doesn’t. The player can still be technically inside a wall, and the physics still work after doing the pause menu enable/disable.
Just for the sake of it, here are the Rigidbody2D setup:
And the “Physics 2D” window:
I also tried unchecking all the collision matrix boxes for the “Player” but that doesn’t seem to affect sprites either.
Has anyone got any idea what could be causing this? Let me know if you need some more information.