Hello everyone,
I'm having a weird issue where when I press the "Pause" key/button the menu shows but if the player is currently moving they will keep moving even whilst the menu is shown until they hit a collision. I'm not sure exactly what's going on, I have pause game paused when the when active checked. Any help would be greatly appreciated
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Are you using Active Inputs to turn the Pause menu on, or its default "On Input Key" setting, and what physics components does your Player character have? Screenshots of both would be best to understand the situation.
We'll need to determine if this is a case of the game not pausing, or the character somehow moving while the game is paused.
Enable the AC Status box via the bottom of the Settings Manager. At the time the issue occurs, check the box in the top-right corner of the Game window - what is the "Game state" set to?
Ok, so as for the physics component, it's using whatever the default 2D character wizard made with it as I don't think I've changed anything. The AC Status box states that the game is paused when the player is still moving.
Should be easy to replicate if you change the movement to direct, change the menu to appear to On Key Input, and just hold down a directional key and press the "menu" key to bring up that menu whilst walking.
Such a Menu exists with the 2D Demo, but switching the movement to Direct and clearing the pause background from the Menu Manager (so that the game is still visible) does not cause the issue on my end.
Is the same true for you with the 2D Demo?
That's very odd, it seems to work fine in the 2D demo. I'm not sure what's the cause. I'll scrub through the differences and see if I can find anything out of place. Any ideas on what it could be?
P.S What's also odd is that I used all my asset files in the 2d demo and it still worked. It just won't work in my new scene.
EDIT: I just figured out the problem! I'm using a particle system that uses unscaled time. through a custom script. If I add a toggle to turn it on and off only when the pause menu is open it should work as normal, right?
A particle system with unscaled time alone shouldn't cause an issue - at least it doesn't on my end. It may be to do with the custom script that calls it.
To make a change at the time the game pauses and unpauses, you can hook into the OnEnterGameState / OnExitGameState custom events:
Thanks again, Chris! This will be most useful!