参考ページ:
http://docs.unity3d.com/ja/current/Manual/StreamingAssets.html
http://neareal.net/index.php?ComputerGraphics%2FUnity%2FTips%2FScript%2FLoadFileByUsingWWW
●Streaming Assetsなら
// Application.dataPathはAssetsの直下のフォルダの事
string path = Application.streamingAssetsPath + "/myAssetBundle.unity3d";
●Assets直下なら
// Application.dataPathはAssetsの直下のフォルダの事
string path = Application.dataPath + "/myAssetBundle.unity3d";
●アセットバンドルロードに利用してみる
LoadAssetBundleData.cs
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class LoadAssetBundleData : MonoBehaviour {
public void OnLoadAssetBundle()
{
StartCoroutine(LoadAssetBundle_CreateMemory());
}
IEnumerator LoadAssetBundle_CreateMemory()
{
// Application.dataPathはAssetsの直下のフォルダの事
string path = Application.dataPath + "/StreamingAssets/myAssetBundle.unity3d";
WWW www = new WWW("file://" + path);
yield return www;
var assetBundleCreateRequest = AssetBundle.CreateFromMemory(www.bytes);
yield return assetBundleCreateRequest;
AssetBundle assetBundle = assetBundleCreateRequest.assetBundle;
Object[] objectArray = assetBundle.LoadAll();
List<Object> myList = new List<Object>();
myList.AddRange(objectArray);
foreach(Object obj in myList)
{
Instantiate(obj);
}
}
}