Skip to content

Instantly share code, notes, and snippets.

Last active Dec 16, 2015
What would you like to do?
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class Load : MonoBehaviour {
IEnumerator Start ()
// ステージを読む
var stageAB = AssetBundle.LoadFromFile (Application.streamingAssetsPath + "/stage");
SceneManager.LoadScene ("stage", LoadSceneMode.Additive);
// モデルデータやテクスチャを非同期でロード
var modelABResult = AssetBundle.LoadFromFileAsync (Application.streamingAssetsPath + "/ball");
yield return new WaitWhile (() => modelABResult.isDone == false);
// missingな設定を再設定
var gimic = GameObject.Find ("Gimic");
gimic.SetActive (false);
gimic.SetActive (true);
// 依存の解決に1F何故か必要
yield return null;
// AssetBundleを解放
modelABResult.assetBundle.Unload (false);
stageAB.Unload (false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment