Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using UnityEngine;
using System.Collections;
using System.IO;
public class LoadTexture : MonoBehaviour {
[SerializeField] string fileName = "icon";
[SerializeField] GUITexture gui;
IEnumerator Start () {
string path = "file://" + Path.Combine( Application.streamingAssetsPath , fileName);
using(WWW www = new WWW(path))
{
yield return www;
Texture2D tex2d = www.texture;
tex2d.Compress(true);
gui.texture = tex2d;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.