-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Description
What problem does this solve or what need does it fill?
For my game I'm loading a single file with two different asset loaders, each producing a separate asset. One asset is a BlockDefinition which will contain all properties necessary to simulate the block, such as its collision shape and behavior. The other asset is a BlockVisuals which holds all that is necessary to display the block, such as mesh, texture and material. The latter would not be loaded on a headless server.
I want to be able to hot reload these assets including adding and removing them on the fly for ease of development or modding.
What solution would you like?
It would be nice to have a typed alternative to load_folder that allows me to specify what type of asset I want to load. Since this API will decide what type of asset to load a file as depending on the extension, I won't ever be able to load a single .ron file as two separate types of assets using it.
What alternative(s) have you considered?
- Hardcode the asset paths instead.
- Use a manifest file which mentions all the other files that need to load. Necessary on web anyway?
- Split the file into two, with different extensions, so
load_foldercan handle them. - Register only a single asset loader, but a different one depending on whether on headless or client, which can then load
BlockDefinitionandBlockVisualsas sub-assets/dependencies from the single file with the right type explicitly, and use asset events to collect them into resources? Seems a bit over-engineered.
Additional context
Source code of the project available to browse here.
Related issues / pull requests
- Replace the load_folder API by load_batch #19760 has the same issue. But a typed version of it would be nice.
- A way to iterate through directories in asset loading #11061 mentions how it's no longer possible to access directories. (Though unsure how this would work with hot reloading.)
load_folder()only on someAssettypes/extensions #2291 – OP mentions a typed API, but commenters ended up talking about filtering paths only.