Open d-eisenga opened 2 years ago
I'll have to look into this more. I'm pretty sure that PackedScene is reference counted, and will get auto freed when there is nothing else using it.
I'd assume if it's a value in a dictionary that would be considered a reference, but I admit I don't know much about Godot memory management.
Is this problem solved? Can you write if it is solved?
Hey @mrParabol . Unfortunately I ran into a design flaws with the current code. I'm working on a partial re write that should solve these problems. I've just been super busy with real world stuff. So I haven't had as much time to work on improving things. Hopefully I will have more time soon.
hello @workhorsy Thank you for your answer. I understand you. In fact, if you explain why the added scene is not deleted or stayed in Cache, I can continue my way. I delete the added scene from the stage tree, but when I switch to different stage, the scene I deleted is added again. I am making a game and I used your plug -in in my game, but I cannot release my game with this problem. I used this plug -in in many different places, and I can't go back. If you can give a clue to prevent my efforts from going to waste, I will be grateful to you.
Hi @mrParabol . It sounds like you are talking about 2 different bugs. The cache only loads and stores a PackedScene. Those PackedScene resources are then cached. Instances of those PackedScenes are not cached. The instances are then added to the scene tree.
I think this may be a different bug. Can you show the code where you are using the plugin to add and remove to the scene tree?
Thanks
I was looking at SceneLoader.gd, specifically the
_get_cached_scene
function, and it looks like scenes never get removed from the_scenes
cache. It looks like the cache just going to grow and grow while the game runs, using ever more memory. Some way to remove scenes from the cache will probably be needed for larger games.