I’ve been a long time user of the Resources-folder, but I’m trying out the AssetBundleManager, as it has been marketed as somehow an improvement to asset loading.
I’m only using it locally, and my assets will never have to be downloaded from anywhere.
Everything is working fine in the editor in Simulation Mode. And when I hit Build AssetBundles, they build just fine.
But how do I get them into the build?
When building e.g. a Mac Standalone, how do I best get them into the Application-folder that’s created, so I can reference them from the game?
I thought this was automated, when using AssetBundleManager - but it doesn’t seem to work this way…
Any suggestions or pointers are most welcome
It is natural to think that it should be automatic. But it’s not!
StreamingAssets is the answer you are looking for.
Unity Manual - Streaming Assets
AssetBundleManager does have very LIMITED support of StreamingAssets.
You have to copy AssetBundles your self.
Use the following scarcely documented method before Initialize().
var dir_path = “/” + AssetBundles.Utility.AssetBundlesOutputPath + “/”
+ AssetBundles.Utility.GetPlatformName() + “/”;
You have to care which mode to be used your self.
Simulation mode in the Editor
StreamingAssets mode otherwise
Debug StreamingAssets mode in the Editor
Multiplatform support is a pain.
Think of it when you have both
The truth is, AssetBundle is intended to be used with content distribution server of some sort.
Edit as of June-20th-2016:
I gave it a try myself to confirm my own words and , to my surprise,
I found out SetSourceAssetBundleDirectory() has been broken on iOS platforms.
Actual cause is GetStreamingAssetsPath() in AssetBundleManager.cs .
This is a quick workaround, which supports iOS and Android (and Standalone and Editor).
- else if (Application.isMobilePlatform || Application.isConsolePlatform)
+ else if (Application.platform == RuntimePlatform.Android)
But why is it not using UNITY_IOS , UNITY_ANDROID and stuff?