Hi,
I’m having some problems with loading assetbundles on IOS, in the editor it works though. I’m using Unity 4.0 and i’m loading a .unity3d assetbundle file with animation clips inside. I placed the assetbundle in the Assetbundles folder so path on Mac is Assets/Assetbundles/Backanim.unity3d
XCode error message
Asset bundle creation script
using UnityEngine;
using UnityEditor;
using System.Collections;
public class ExportAssetBundles : MonoBehaviour
{
[MenuItem("Assets/Build AssetBundle From Selection")]
static void ExporResourceNoTrack()
{
string path = EditorUtility.SaveFilePanel("Save Resource", "", "New Resource", "unity3d");
if(path.Length != 0)
{
BuildPipeline.BuildAssetBundle(Selection.activeObject, Selection.objects, path, BuildAssetBundleOptions.CollectDependencies, BuildTarget.iPhone);
}
}
}
Load assetbundle script
public static var LA : LoadAnimations;
var human : GameObject;
private var anim : UnityEngine.Object[];
private var file : WWW;
function Start()
{
LA = this;
human = GameObject.Find("Human");
}
function LoadAnimation()
{
Debug.Log(Application.dataPath);
file = new WWW("file://" + Application.dataPath + "/Assetbundles/Backanim.unity3d");
yield file;
Debug.Log(file.url.ToString());
if(file.error != null)
{
Debug.Log(file.error);
}
anim = file.assetBundle.LoadAll(AnimationClip);
setAnimations();
}
function setAnimations()
{
//Back animations
human.animation.AddClip(anim[8], ButtonText5G.BT.backArray[0], 0, 120, false);
human.animation.AddClip(anim[0], ButtonText5G.BT.backArray[1], 0, 200, false);
human.animation.AddClip(anim[0], ButtonText5G.BT.backArray[2], 250, 425, false);
human.animation.AddClip(anim[0], ButtonText5G.BT.backArray[3], 460, 750, false);
human.animation.AddClip(anim[0], ButtonText5G.BT.backArray[4], 800, 1000, false);
human.animation.AddClip(anim[7], ButtonText5G.BT.backArray[5], 0, 100, false);
human.animation.AddClip(anim[1], ButtonText5G.BT.backArray[7], 300, 600, false);
human.animation.AddClip(anim[1], ButtonText5G.BT.backArray[8], 700, 900, false);
human.animation.AddClip(anim[1], ButtonText5G.BT.backArray[9], 1101, 1250, false);
human.animation.AddClip(anim[2], ButtonText5G.BT.backArray[10], 0, 200, false);
human.animation.AddClip(anim[3], ButtonText5G.BT.backArray[6], 1, 150, false);
human.animation.AddClip(anim[4], ButtonText5G.BT.backArray[12], 1, 125, false);
human.animation.AddClip(anim[5], ButtonText5G.BT.backArray[13], 1, 100, false);
human.animation.AddClip(anim[6], ButtonText5G.BT.backArray[11], 200, 400, false);
}
Can someone point out what i’m doing wrong here?