Instantly share code, notes, and snippets.

Embed
What would you like to do?
AssetBundleシミュレーターのサンプル
using UnityEngine;
using System.Collections;
public class Sample : MonoBehaviour {
void Start () {
// シミュレーターを初期化.
AssetBundleSimulator.Instance.Init ();
// prefab AssetBundleに格納したRollerBallオブジェクトを取得してインスタンス化.
var prefab = AssetBundleSimulator.Instance.LoadAsset<GameObject>("prefab", "RollerBall");
GameObject.Instantiate (prefab);
// prefab AssetBundleに明示的に格納した全アセットをインスタンス化.
var prefabs = AssetBundleSimulator.Instance.LoadAllAssets<GameObject>("prefab");
foreach (var obj in prefabs) {
GameObject.Instantiate (obj);
}
// scene AssetBundleに格納したStageシーンをロード.
AssetBundleSimulator.Instance.LoadScene ("scene", "Stage", UnityEngine.SceneManagement.LoadSceneMode.Additive);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment