So the last little bit I have been working on a web game that is comprised of 11 different scenes (10 levels and a main menu).
To make the game extremely lite-weight on initial load we decided to bundle the music for each level and each level themselves separately. This resulted in 21 separate asset bundles. (2 bundles per level + the main menu’s bg music)
To make things simple for programming, a basic asset loader component was constructed and placed along side each scene’s main managing script. On initial load of main menu, the music is loaded in. The user will then be able to navigate around the main menu and eventually choose a level. Upon selecting a level, a bundle containing the level that was selected is loaded in and then the Application.LoadLevel(“levelname”) is called. This works, to an extent.
Continuously upon returning to a scene that was already visited once before I received this exception:
The assetbundle ‘file_name_here.unity3d’ can’t be loaded because another asset bundle with the same files are already loaded
Okay – so… I can’t load in this bundle because it’s already been loaded. That’s fine, I’ll just check if the bundle has been loaded before I load it. Sounds simple enough. – Famous last words.
Read the rest of this entry »