Hi I just noticed a problem that I’ve never experienced before in my game. I have the player pause the game with the “P” key, “Escape” key, or their controller. Then, when the ‘Pause screen’ sprite is added to the game with the UI layer, it makes the Base layer completely go missing. The game is still playing in the background with all of my sound effects and player damage code working properly.
I don’t know if this has to do with my code or something that’s behind the scenes. I’ve managed to recreate this problem on multiple HTML5 exports as well as my Current build to GDGames.
Hello! I’ve been getting some help on the Discord server so i wanted to share what we learned there so far. So i tried removing the timescale to see if that would be the issue, and once the time scale is removed it adds the pause screen image and removes the image without issue. However the game won’t pause without the time scale.
Worth noting that the pause screen image does not cover the entire screen only a portion of the screen.
So we also discovered there was an effect applied to some layers of the game a light source effect. Since i do not use that in my game whatsoever, i took out that effect. There are only 2 effects used in the entire game, “Glow” on the player and “outline” on the title screen and game over screen.
I tried removing all the effects and added back in time scale. But it seems the base layer is still becoming invisible for no reason after i pause and unpause the game between 2-X number of times.
Update as of today . . . I realized that i was using scene variables for my pause function, and they were all named the same thing for each scene. I was trying to pause using a global event.
So first I tried deleting all the scene variables, and then i added a global pause variable. This seemed to work, but then after about 10 times pausing the game, the base layer went blank again.
To be CLEAR, i am not using any black images for tweening in my game.
So now i went into my “level 1” scene and created a new scene variable called “pause1.” I deleted my global code and put this code into “level 1.” Then after about 10 times pausing the game, the base layer gets deleted.
Yes i realize most people will never pause the game this many times, but It has happened to me even after pausing the game only once.
My next step is to get the variables changed from a boolean to a number variable to see if this may be the issue.
I recommend as next step stripping away all logic then adding it back in one by one. This way you will find the cause and address it.
Remove “trigger once” from the sub-events. You already trigger once in the parent event. Remove all the logic and simply set timescale without any other code whatsoever involved.
Okay i’m back again. I deleted all my old code and followed the tutorial exactly like the video. It still produces the same results. After 5 times pausing the game, the base layer goes blank.
This is a Time Scale Bug. I just tried setting the time scale to 0.3 instead of Zero when the game is paused. The base layer remains visible. There is a bug attached to this event when the time scale is set to zero.
I looked at an old project of mine but the pause menu works as intended thought I would post a screenshot of the pause events to see if it’s of any help.
Thank you, I’ll take a look at that later. I did notice you’re using create and delete sprite instead of hide and show.
I was thinking this might be a factor, however I completely deleted all my old code and variables. And when I tried to reconstruct the code only with the time scale set to zero, and then back to one. The scene base layer goes blank.
I would say as personal experience it’s the hide and show as when I have used hide an object then create and object at the same location the original object momentarily appeared.
Hey everyone, I haven’t forgotten about this problem. I made a temporary fix for now, i set the time scale to 0.01 and it does work. The game moves extremely slow in the background, but it does not crash. I can pause and unpause the game lots of times. Since my Steam Page just went live I’ve been busy getting trailers & marketing, as well as designing the last few levels of the game.
I have a new project file with only some level art assets that i can use to test the hide/show versus the create/delete an object events. Once i get some results I’ll be back to post an update.