Created
July 24, 2017 12:42
-
-
Save tsubaki/e8f64dc3c79bf44ab9227b81681aa724 to your computer and use it in GitHub Desktop.
Streamから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 System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using System.IO; | |
public class LoadAssetbundle : MonoBehaviour { | |
void Start () { | |
Sprite sprite; | |
using (FileStream reader = new FileStream (Application.streamingAssetsPath + "/data", FileMode.Open)) { | |
var ab = AssetBundle.LoadFromStream (reader); | |
sprite = ab.LoadAsset<Sprite> ("CratePinkGridSprite"); | |
ab.Unload (false); | |
} | |
GetComponent<SpriteRenderer> ().sprite = sprite; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment