Hi Guys!
Im working in something.
The Idea its pretty simple, the user will load and texture for an especific object.
Im Using UnityEditor to get the path, and im stored it in a Stirng.
Somehint like this:
using UnityEngine;
using UnityEditor;
using System.Collections;
public class LoadContent : MonoBehaviour {
string path;
void Start () {
}
void Update () {
}
void OnMouseDown(){
path = EditorUtility.OpenFilePanel("Overwrite with png", "", "png");
Debug.Log(path);
StartCoroutine (LoadImageAsTexture (path));
}
IEnumerator LoadImageAsTexture(string sPath){
WWW www = new WWW (sPath);
yield return www;
Texture2D texTmp = new Texture2D (256,256);
www.LoadImageIntoTexture(texTmp);
this.renderer.material.SetTexture ("_MainTex", texTmp);
}
}
But it doesnt work, mi Quad isnt changing Texture.
I Hope you could help me guys.
Thnks!!!