Question by
interactionfactory · Dec 29, 2015 at 12:01 PM ·
textureupdatewwwurl
get image on url, replace and reload in runtime
Hello I'm trying to get an image from a url, for that I have made this script in C # .. working properly .. corutine as I use to validate the download, I can not do it in update, what I need is that if I overwrite the .jpg file on the local disk, web, or unity do reload and show the new img.
I am new to scripting, so I urge you stick the complete code if anyone knows how.
thanks.
//antonio Cotos
using UnityEngine;
using System.Collections;
// Get the content by url
public class www : MonoBehaviour {
public string url = "http://192.168.0.15/demo/img/1.png";
IEnumerator Start() {
// Start a download of the given URL
WWW www = new WWW (url);
// Wait for download to complete
yield return www;
// assign texture
Renderer renderer = GetComponent<Renderer>();
renderer.material.mainTexture = www.texture;
}
}
Comment
Your answer
Follow this Question
Related Questions
How can resolve URL with caracter like & and other ? 2 Answers
Get material texture file name 0 Answers
Stream Audio from a URL? 3 Answers
Need help with an image path script 0 Answers
Download files, not stupid HTML code! 0 Answers