Having a difficult time finding much information on how AssetBundles actually work. Can't find any explanation on how to manage asset bundles with a game build.
Basically I have a folder called AssetBundles
in my Project window. All assets that I put in this folder are built as AssetBundles in a folder within my build directory (like GameName/Data/AssetBundles) which are then loaded when needed.
But when I build the game itself, does it know not to include these assets that are being used in AssetBundles in the game build? Or do I need to exclude them in some way?
Edit: I've made some progress.
To my understanding, only assets of which reside in scenes that are in the build settings will be built with the game build. Scripts are always built in the game build (I'm not sure if there's a way of getting around this but it's not an issue to me).
So I have a single scene which is in the game build which acts as the startup object of the game. This scene has an Asset Manager script on it with DontDestroyOnLoad
specified in Awake
.
My asset manager script basically just handles loading/unloading of bundles, assets and instances.
I'm currently not too sure about how building asset bundles for scenes work. I have it working using LoadAllAssets
and then doing LoadLevel
, but what if multiple scenes share some assets? Do scene builds end up bloated having copies of assets that can be shared? I read that dependencies are automatically handled in Unity 5, but I'm not sure if that relates to this.