Home > Article > Backend Development > Can Unity WWW and AssetBundle just throw the assets on the server? adt bundle bundle what does adt-bundle-window mean
The answer is definitely no
1. In order to actually verify the actual effect of this function, I am prepared to die
1. One server, one domain name: Rent an Alibaba Cloud server (the minimum configuration is more than 70 yuan a month) and buy a domain name (the first purchase only costs 4-9 yuan)
2. Install an http server. I use Nginx server. I don’t know how to configure the specific Apache service.
3. Read the introduction of momo’s AssetBundle function
2. Function implementation - (server)
1. Create a directory on the server, and then throw the resources to the server
Here is the directory on my server (it is unethical to attack other people's servers at will)
2. Change the configuration file on the server, otherwise an error 403 or 404 will be reported. My server configuration is like this (it is unethical to attack other people's servers at will) servers are immoral), if you don’t understand server conf, educate yourself. .
3. Function implementation - (client)
<code><span>public</span><span>static</span><span>readonly</span><span>string</span> PathURL = <span>"http://wangpeng.online:10001/Prefab0.assetbundle"</span>; <span>void</span> OnGUI() { <span>if</span>(GUILayout.Button(<span>"TestAssetBundle"</span>)) { StartCoroutine(LoadGameObject(PathURL)); } } <span>private</span> IEnumerator <span>LoadALLGameObject</span>(<span>string</span> path) { WWW bundle = <span>new</span> WWW(path); <span>yield</span><span>return</span> bundle; <span>if</span>(!<span>string</span>.IsNullOrEmpty(bundle.error)) { Debug.Log(<span>"ERROR:"</span>+bundle.error); }<span>else</span>{ Debug.Log(<span>"SUCCESS TO DOWNLOAD:"</span>+bundle.bytesDownloaded); } <span>yield</span><span>return</span><span>0</span>; <span>//通过Prefab的名称把他们都读取出来</span> Object obj0 = bundle.assetBundle.LoadAsset<Object>(<span>"Prefab0"</span>); <span>//加载到游戏中 </span><span>yield</span><span>return</span> Instantiate(obj0); }</code>
4. Call successful
The latter sentence is printed by the loaded gameobject. The example is momo's big resource package
The above introduces Unity WWW and AssetBundle. Is it enough to just throw the resources on the server? , including bundle and asset content, I hope it will be helpful to friends who are interested in PHP tutorials.