Created
March 18, 2016 16:45
-
-
Save tsubaki/5c68fff06e7bdb3754e8 to your computer and use it in GitHub Desktop.
character1, character2, character3といったAssetBundleから、1枚ずつ取得
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.UI; | |
public class LoadAssetbundle : MonoBehaviour | |
{ | |
IEnumerator Start () | |
{ | |
var image = GetComponent<Image> (); | |
var assetbundleNames = new string[] { "/character1", "/character2", "/character3" }; | |
yield return new WaitWhile (() => Input.GetMouseButtonDown (0) == false); | |
float time = Time.realtimeSinceStartup; | |
// character1, character2, character3といったAssetBundleから、1枚ずつ取得 | |
foreach (var assetbundlename in assetbundleNames) { | |
var assetbundle = AssetBundle.LoadFromFile (Application.streamingAssetsPath + assetbundlename); | |
var asset = assetbundle.LoadAsset<Sprite> ("01制服哀"); | |
image.sprite = asset; | |
assetbundle.Unload (false); | |
} | |
Debug.Log (Time.realtimeSinceStartup - time); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment