mardi 19 avril 2016

Loading image from the server using resource folder

I am loading my images from resource folder. Now the requirement have change and I have to develop the WebGL Player instaed of standalone build. Now my question is do resource exist on server and will it work on the server same or i need to change everywhere with www and co-routine like below.

public string url = "http://ift.tt/1iBlctx";

void OnGUI() { 
   if(GUI.Button(new Rect(10,10,300,10),"click to load from server")){
       StartCoroutine("LoadImageFromServer");
    }
}//*/

IEnumerator LoadImageFromServer() {
    WWW www = new WWW(url);

    // Wait for download to complete
    yield return www;
    Renderer renderer = GetComponent<Renderer>();
    renderer.material.mainTexture = www.texture;
}




Aucun commentaire:

Enregistrer un commentaire