Hello,
I’m working on a game that will eventually have a lot of graphics and physics assets, so I want to clear out everything when I switch between levels (or when I restart a level).
I’ve set up some print statements in each of the storyboard functions (as well as at the top of the lua file), and I notice that by default, Storyboard only runs the initial declarations and CreateScene once, then prefers to just EnterScene and ExitScene when switching between lua files. DestroyScene isn’t called unless I call PurgeScene or set PurgeOnSceneChange to true, which means all my assets are still floating around in memory (probably consuming resources). However, if I do purge a scene, when I try to reload that scene, I’m not seeing the print statement I placed at the top of the lua file show up. It seems Storyboard goes directly to CreateScene if the lua file has been previous loaded, skipping any initial declaration statements (such as require physics), which is causing problems when I try to reinitialize stuff in CreateScene the second time the file loads.
Am I missing something simple, or is this something I really need to worry about. I eventually want to have multiple levels, but if DestroyScene isn’t called unless I manually purge the scene, and if there’s no way to reinitialize all the stuff in the header, this could lead to a big headache.
Any help is appreciated!
Anthony