Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
StreamからAssetBundleを取得する
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