Unity – WWW – Get an Image from Web
1. MAIN TOP MENU> File> New Project…
2. MAIN TOP MENU> GameObject> Create Other> Cube
3. Hierarchy> select Cube> Inspectot> ‘Add component’> New Script> JavaScript> name it LoadImage.js
4. LoadImage.js
1 2 3 4 5 6 7 8 9 10 11 12 | #pragma strict // Get the image function Start () { // Start a download of the given URL var www : WWW = new WWW (url); // Wait for download to complete yield www; // assign texture renderer.material.mainTexture = www.texture; } |
5. TOP Play button to see the final result
—
Reference:
http://docs.unity3d.com/Documentation/ScriptReference/WWW.html