Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Created August 29, 2016 16:30
Show Gist options
  • Save tsubaki/7c1b82e505732542b1afe4d5be98d8a8 to your computer and use it in GitHub Desktop.
Save tsubaki/7c1b82e505732542b1afe4d5be98d8a8 to your computer and use it in GitHub Desktop.
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