[SOLVED] Issue with scenes changes

Please stop this dumb arguing and ruining my work.

Pause and Change Scene are two diferent things, one “pauses” and keep your stuff untill you use return to paused scene and the other STOPS it and suposedly deletes it.

I KNOW THIS, you should too, it says on the tooltip exactly what that does.

On my project i use change scene, im not a morron.

There is a memory leak on changing scenes, not pausing scenes, CHANGING.

I tested it plenty with my project, its like i said, the diference is on the “Callback…” like i already explained.

Please focus on the original point.

2 Likes

Please focus on the original post and what i found, not on clear user issues.

Its not a user issue on my end, iv gone through all the possible things on my end, im using all the right action and conditions, im not pausing scenes, im changing them.

Its like i mentioned before, the diference between the two projects is on the “Callback…” if that helps.

Let me know if theres something else i can do

Ok someone explain this to me…

  • As i was cleaning up more progaming i noticed i left an old condition from when the project used scene changing, the “Scene has finished Preloading” was still active on one of my “fake” scene changes, deleting everything, creating external layout stuff… and it was working, EVEN THO it was a condition check and i DID NOT tell it to preload that specific scene, the check still passed as true and the action happened, thats why i didnt realise that condition was still there.

So… i double checked this whole scene thing again, and…

  • If a scene exists in your project, IT WILL BE PRELOADED at the start of the game no matter what, the action “Preload Scene” means NOTHING, the scenes are ALWAYS being pre loaded.

How do i notice this? Easy testing for anyone who wants to check it out.

All i did was make a block with the conditions: If key is pressed, If scene has finished preloading, Trigger once, and then the action “Change Scene”.,

It will work, even tho you DID NOT tell it to preload the specific scene, i tried it with all the unused scenes, and they were ALL PRE LOADED.

I also did the exact same thing but instead of If the scene has finished preloading, i used “If the scene exists”, and it was checked as true, the action happened, changing the scene.

So… again, the hell? Why are all scenes preloaded even tho i never told it to load them or change to them?

Everything is already preloaded in the background, it all exists there, you telling me there NO CHANCE of a pileup in memory? even tho its loading stuff you dont want it to load?

I also keep notecing performance drops when opening GDevelop for the first time, after a little while and restarting the software it all goes smooth again.

Please have a better look at this, i love GDevelop, im not just knocking it, i want to help make it work properly.

Let me know if i can help

Another little update…

All Scenes Pre Load at the Start of ANY Scene without being told to do so.

EVERY time you change a Scene, ALL scene Pre Load.

I made a condition, If the specific scene finished pre loading, trigger once, with the action Play a sound.

At the start of the game the sound rings, evety time the scene changes, the sound rings again…

You sure this had nothing to do with it? Why are all scenes being loaded in the back every time you change a scene? thats silly and clearly not right.

I get you wanted to make the game load slowly in the back to make loading faster and all, but this is counter productive, its loading ALL SCENES, EVERY TIME A SCENE CHANGES.

Clear enough? Its easy testing, just do what i did.

EDIT: You know all things considered, this means that RMDB was actually right in saying GDevelop dosent delete scenes and keeps stuff in memory, even tho his issue was more user related, this is actually true if scenes are always being preloaded and kepts in the background, which is super silly…

This is expected. The action only changes priorities. Please take a look to the documentation.

https://wiki.gdevelop.io/gdevelop5/all-features/resources-loading/

“trigger once” condition is not global. “scene finished pre loading” condition is still true when the scene changes so it will play the sound. It doesn’t mean that the scene is pre-loaded again.

Nowaday, most devices have a lot of RAM so keeping every asset in memory is rarely an issue. Reloading assets from the device storage drains a lot on the battery and must be avoided as much as possible.

This just dosent seem right, please have a better look at this, theres clearly something going on when changing scenes.

Is it really so hard to check? Theres clearly an issue, and the more we talk about it more people come up to say “Hey i had the same issue”. So theres clearly an issue.

What about the “Scene exists” condition? Why does that work? Whats the priority on that? Whats the point since they allways exist, if you stop one another preloads on the back, they always exist, you sure that cant be it?

I’m a revolutionary!..lol…joke aside,…
I wasn’t rite, because indeed scene changes and only globals are kept…

What i learnt at my expenses is that you must check every damn global and every object binded to them before and after the swap…

I doubt it’s your case but definitely is mine… and if they could cause a lag??..i don’t really know.

About your memory leak issue i’m not a dev but maybe you could try to manually compile your game to an exe to see if your lag happens in the real game too…it could be a preview sync issue?
Sometimes i do this to check mine and while i notice some lag in editor…there is none in the compiled game

Its not a preview thing issue, i already compiled that game before starting this thread, its the same on there.

Also i had a look at the documentation, no real info about Scene Exists…

Scene Exists, checks if a Scene Exists… Which it does, even tho i never told it to load that scene or changed to that scene or did anything with that scene, So why does it exist?!

Please answer me that

And also, the way i tested it, the preload with sound experiment, was with an external event page, the same one linked to diferent scenes and not using anything to trigger them at the start of the scene, only triggering when the scene was preloaded, this always made ti ring on scene changes.

I tried it in diferent ways, using events from seperate scenes, external events linked to diferent scenes, etc, they always acused scenes being loaded other then just on the start of the game.

and again… Why does Scene Exist work?!

I think i get the scene exists thing, didnt know you could generate new scenes with events and that the ones on the editor are the ones you “declared” i guess? if thats the case then it makes sense i supose.

Theres still something not right with the loading in the background, it really cant be that hard to poke around under the hood and check if everything is in order considering its not just me having this issue and ever since i stopped using scene changes, i stopped having issues…

As every engine GD is not perfect.
Even Unity had and still have some lag issue and unknown fatal crashes.
Same with UE5…(there are still ppl w8ing for fixes).

GD devs are really active and surely they are already on the matter, but i doubt your fix will come soon.

ALL you can do for now is to adapt your game on the current ver and prepare it for when a fix will come.
I too have an unfixed behaviour that stopd me to expand my game but for now i’m focusing on other things and hopefully one day i’m gonna have the chance to implement it back.

I read something that made me think you could create a scene with events, i just tried and you cant… which would make sense… so… “Scene Exists” makes no sense to me or why it would trigger as true if i never changed to that scene before…

Cos there are people who asked the feature…eg
here [Solved] How do i detect if scene does not exits - #4 by Bouh
and here (SOLVED) Is there a way to check current scene?
you may go in depth to know why.(.i guess bouh know why)…someone make extensions based on users requests and its great

@MagicBiscuit Thank you for reporting this issue and giving an project to reproduce it.

The memory leak is in the FlexBox extension. This extension was created before there were 2 tiers lists. We moved it to the community tier list and added a warning in the description about the memory leak.

1 Like

Thank you @davy for taking time to dig into the issue.

So the problem lies in this extension that seems to create “DOM” (HTML) elements in memory and never release them when a scene is changed.

Note that this is not a problem of the game engine: there is no leak for scenes, variables are not leaked (and would not create anything similar to a slowdown before multiple hours at least, if not days - variables are super tiny in memory), GDevelop is safe on this side.

Sadly it’s not always easy to check if extensions have such problems. In this case it would be great if someone can fix the extension, but we can’t support all the community extensions so for now we added a warning.

3 Likes

Thank you guys for being so quick about it!

Im glad you were able to find the issue, and that makes perfect sense, since the people with this problem were making RPGs, and the Flex Extension is great for making UIs, Inventory Stuff like Items and such… Thats why we had issues with similar game types…

I really hope the author can fix it since its such a cool extension, any way to contact him saying what happened?

Thanks again for everything, sorry iv i came across as a rude prik at times, but i was so sure there was a memory leak, tested it in so many ways, it was frustrating, sorry about that.

Like i said before, i love GDevelop, i hope it only keeps getting better!

Do you think it might be an issue with the global variables? Like, its not updating the old ones and instead everytime it updates it creates new ones on top or something like that?..

They literally just said it has nothing to do with that.
Its like just 2 posts above :slight_smile:

Its the FlexBox Extension, i just removed it and it everything works fine again…

Sadly im gonna have to find a new way to make my inventory stuff

Silly question, how do i flag this thread as “Solved”? I have no idea how that works.

Nevermind, im dumb some times… i worked it out :smiley:

1 Like