reproduced from Wind Yu Chong Unity3d Tutorial College
download pictures from a Web server
On a talk about the wind Yu Chong introduced the Wamp server and installation. This explains how to download content from the server to the Unity3d program.
To the Wamp path under the WWW folder to drag a picture, where the use of cat.jpg, input http://localhost/cat.jpg, you can see the picture below,
New Unity Project, create a sphere, create an arbitrary name material, and assign the material to a sphere. Create a script named GetImage with the following code,using Unityengine;using System.Collections; Public class Getimage:monobehaviour {void Ongui (){if (GUI. button (new Rect (0,0,100,50), "Get Image")){Startcoroutine (Getwebimage ());}}IEnumerator getwebimage (){www mywww = new www ("http://localhost/cat.jpg");yield return mywww;renderer.material.mainTexture = mywww.texture;}}
After running, click on the top left button, the white ball is given to the page image as a map, how, simple?
Summary: Unity3d reads HTTP content on the core is mywww =www (URL), according to what type of content you read, if the text is Mywww.text read, is the picture mywww.texture read, is the video Mywww.movie read. It can be used or stored later.
Unity3d Tutorial Web Server Chapter: (second) download pictures from the server