Created
January 17, 2013 13:47
-
-
Save tsubaki/4556005 to your computer and use it in GitHub Desktop.
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 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