Created
August 29, 2016 16:30
-
-
Save tsubaki/7c1b82e505732542b1afe4d5be98d8a8 to your computer and use it in GitHub Desktop.
AssetBundleシミュレーターのサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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