- Home /
Question by
Naeja · Sep 08, 2016 at 03:07 AM ·
materialassetbundleassetbundles
Default Sprite Shader is missing from prefab loaded from asset bundle?
Hello, Like the title says, the default sprite material does not seem to be included when I load my prefab from an assetbundle. Here is what my code looks like loading assets from the bundles.
IEnumerator DownloadBundle(string name, int version){
while(!Caching.ready){
yield return null;
}
using (WWW www = WWW.LoadFromCacheOrDownload(downloadURL + name, version)){
yield return www;
if(www.error != null)
throw new Exception ("WWW download had an error: " + www.error);
AssetBundle bundle = www.assetBundle;
Debug.Log(bundle.name);
foreach(string s in bundle.GetAllAssetNames()){
Debug.Log(s);
if(s.Contains(".prefab")){
// Debug.Log(s);
LoadPrefab(bundle, s);
}
}
bundle.LoadAllAssets();
// LoadPrefab(bundle, "units_shadow.png");
// bundle.Unload(false);
}
}
IEnumerator LoadPrefabFromBundle(AssetBundle b, string name){
AssetBundleRequest areq = b.LoadAssetAsync<GameObject>(name);
while(!areq.isDone){
yield return null;
}
foreach(UnityEngine.Object o in areq.allAssets){
Debug.Log(o.ToString());
}
GameObject outObj = (GameObject) areq.asset;
switch(outObj.name){
//set outObj to a specfic global variable to be used and instantiated later
}
}
I believe this to be a bug with Unity, I don't see any way to include the default shaders in the bundles, I am using the AssetBundle manager to build and using Unity 5.3.4.0f3.
Comment