Last active
December 16, 2015 02:08
-
-
Save tsubaki/6fae8c1fca9bdb85134b to your computer and use it in GitHub Desktop.
シーン読んだ後にリソースを読む
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; | |
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