The download function is a basic module for most games or software, but many people have no chance to write this full feature.
So I'm going to share my essay when I write this feature.
This article only said that www process download, HTTP synchronization and asynchronous download put in the next article
This simple:
www wwwserver = new www ("http://192.168.1.1:8080/Files/ab.assetBundle"); yield return wwwserver;if (string. IsNullOrEmpty (Wwwserver.error)) { assetbundle ab= wwwserver.assetbundle;//Get AB Package resources
}//if it is mp3, use music-related reception,//If it is a picture, is texture related to receive.
If it is text, it can be string str = wwwserver.text;//at the same time you can also take a stream of ways to get and store,//the following in the WWW download stream way storage I have not actually tested, others are personally tested. Stream OutStream; FileInfo fi= New FileInfo (Application.persistentdatapath + "/file.xx"), if (!fi. Exists) { OutStream = fi. Create (); Outstream.write (wwwserver.bytes, 0, wwwServer.bytes.Length);} Outstream.close ();
Next: HTTP synchronous download and http asynchronous download
Unity download File One (www co-process download)