- Home /
Question by
Fadi · Oct 05, 2015 at 03:33 PM ·
unity 5assetbundle
problem : AssetBundles in Unity5
HI....
I'm trying to use the new AssetBundle in Unity5 , but I've a problem
I imported a cat model to the scene , then attached to it ( Material , Texture , Sound and animation )
then make it as a prefab
select the prefab from project Tab , then create AssetBundle , name it as "cat"
then build it by using this script
static void BuildAllAssetBundles () { BuildPipeline.BuildAssetBundles ("Assets/AssetBundles/CreatedBundles"); }
every thing so far is good .
then I tried to load the assetbundle by using this code
IEnumerator DownloadAndCache (string url)
{
using (WWW www = new WWW(url))
{
yield return www;
if ( www.text == "" )
print ("Error");
else
{
AssetBundle loadedAssetBundle = www.assetBundle;
GameObject gameObject = loadedAssetBundle.LoadAsset("MODEL")as GameObject;
gameObject.transform.parent = transform;
loadedAssetBundle.Unload(false);
}
}
}
now the problem is :
the object load and show in the inspector but disabled.
if I press on it will show on the preview window , but in the scene , disable and I can't remove it either.
the attached image show how it appear on the scene
![alt text][1]
![alt text][2]
what should I do ?
thank you ...
Comment