I’m currently working on slimming down an application for the web. We’ve got a fair amount of dynamic content which we’re loading using the Resources.Load method.
Our use of Resources.Load is heavily dependent on keeping the directory structure as a way of keeping similarly named assets separate from each other.
i.e. resource/ships/shipA/maintexture.png vs resource/ships/shipB/maintexture.png
We’re trying to convert the project to using AssetBundles, so that we can both add content dynamically, and so that we can reduce the footprint of the initial web app. However, when I create an AssetBundle, it does not appear to preserve any information about that asset’s directory structure.
Is there a preferred way to get the usefulness of the path structure in Resources.Load with the flexibility of the AssetBundle?
Some ideas off the top of my head are:
- Rename the asset during the BuildPipeline process using the AssetDatabase.GetAssetPath
- Export only one asset per AssetBundle, and name the bundle after the asset’s path
- Group assets by directory, and export the AssetBundles into a similar directory structure, so that you can use the URL passed to the WWW class as a kind of key.
Is there a better or ‘official’ way to deal with this?
Alternatively, is there a way to bundle assets so that when you load them, they’re auto-magically [sic] available to the Resources class? That would give you the best of both worlds.