-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading assets per scene instead of all assets #128
Comments
Still down for having this as a feature? One proposed approach: I've been experimenting with loading assets per scene (screen) by wrapping the AssetManager so that each scene has its own context-aware tracker. In my approach, when a scene loads assets, they’re tagged to that scene and can be unloaded when the scene is disposed. I'm also incorporating reference counting to ensure that if an asset is shared between scenes, it isn’t disposed prematurely, along with a cache flag to prevent early unloading. Looking ahead, I’ve been contemplating a more granular system using “asset packs” that scenes can load. With asset packs, the entire collection of assets for a scene is managed as a unit. This would allow packs to be swapped in and out easily and even support shared settings across scenes. In such a design, the cache flag might become unnecessary because the pack itself could be marked to prevent auto-unload when it leaves the current context. What do you think about expanding on this idea? |
I like this idea. Currently Mundus stores the assets in an assets.txt file, as a list. Here is the reason why. And this is the current flow: mundus = new Mundus(Gdx.files.internal("mundus")); // Here Mundus loads all assets (what are in the assets.txt file)
scene = mundus.loadScene("Main Scene.mundus"); // Here Mundus loads / initialzes scene what can be rendered And as I understand:
Right? And as I understand these logic would work with custom loaded assets (like sound like here) because the scenes don't change it's reference count. And if we want to use the application like now (to load all assets at startup) then need to load all scenes. |
Is your feature request related to a problem? Please describe.
Currently Mundus loads all assets on both the Editor and Runtime when loading a project. This is fine for small projects, and even makes scene switching fast, but becomes less practical in large projects with lots of assets.
Describe the solution you'd like
Look into refactoring asset loading to only load what is needed for the current scene to see if its viable.
Additional context
This could be a pretty sizable refactor of the loading system and is not a high priority.
The text was updated successfully, but these errors were encountered: