Last active
December 16, 2015 14:43
-
-
Save tsubaki/3640d4e1845a09534bf4 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 LoadAssetBundle : MonoBehaviour { | |
IEnumerator Start () | |
{ | |
var resultAssetbundle = AssetBundle.LoadFromFileAsync (Application.streamingAssetsPath + "/sprite"); | |
yield return new WaitWhile (() => resultAssetbundle.isDone == false); | |
var assetbundle = resultAssetbundle.assetBundle; | |
var resultObject = assetbundle.LoadAssetAsync<GameObject> ("Player"); | |
yield return new WaitWhile (() => resultObject.isDone == false); | |
GameObject.Instantiate (resultObject.asset); | |
assetbundle.Unload (false); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment