Hello,
following this discussion on the Unity forums, I decided to dig around and see how the new assetbundles works. I found a video from Unite2014 about it where they did exactly what was described in that thread about having different assets for different builds. Luckily the person who held the presentation also uploaded the source that he used to demo the new Assetbundle features.
Using the project as a template I was able to create a SD and HD version of a sample sprite. However when Implementing the code to my own project I wasn’t able to do so. The scripts I used are the same as in the assetbundle demo mentioned above. Bellow I have screenshots of my folders and assetbunde labels:
As the folder names suggest, they have the label suffix of .hd, sd and ud respectively.
Shows the labels.
The scene used in this is an empty scene with a canvas and a panel, the panel uses the BG sprite in its Image component.
Bellow is the loader script I’m using:
public class LoadVariants : BaseLoader {
public string variantSceneAssetBundle = "xplatform/assetbundletest.unity3d";
public string variantSceneName = "assetbundletest";
public string[] activeVariants = {"hd"};
// Use this for initialization
IEnumerator Start () {
yield return StartCoroutine(Initialize() );
// Set active variants.
AssetBundleManager.Variants = activeVariants;
// Load variant level which depends on variants.
yield return StartCoroutine(LoadLevel (variantSceneAssetBundle, variantSceneName, true) );
// Unload assetBundles.
AssetBundleManager.UnloadAssetBundle(variantSceneAssetBundle);
}
}
Which is exactly the same as in the demo, but with the label strings changed. All the other bundle building code, loading code, etc is the same as in the demo.
Did I miss a vital piece of setup ?
Thanks in advance for your time!