When a scene is loaded using loadSceneHeirachy
, what is the correct way to unload the scene and free up all assets for GC? We currently have the following…
assetlistloader.load() // preloads a set of assets
loadSceneHeirachy() // runs the scene
// some time later
// root.destroy() // removes entities but not assets
// what next?
in this situation, I believe the assets are internally cached, so they remain in memory. The assetlist loader has a destroy method, but I that just stops any further loading and doesn’t seem to touch the assets themselves. unloadSceneData
seems to invalidate the data
property of the scene registry item but I’m unsure if that also clears the cache. Also if the Assetlist loader maintains reference to the assets then they’d never get GC