日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

U3D assetbundle加载

發布時間:2025/3/18 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 U3D assetbundle加载 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

U3D assetbundle加載

1 using UnityEngine; 2 using System.Collections; 3 public class testLoadFromAB : MonoBehaviour { 4 5 IEnumerator DownloadAndCache() 6 { 7 while (!Caching.ready) 8 yield return null; 9 10 //注意,從本地加載時,必須使用前綴 file:///或file://,從網絡加載則使用 http://,這兩種協議可以在iphone和WINDOWS, 安卓上通用 11 //UNITY MANUAL: 12 //http://, https:// and file:// protocols are supported on iPhone. 13 //ftp:// protocol support is limited to anonymous downloads only. Other protocols are not supported. 14 WWW www = WWW.LoadFromCacheOrDownload ("file:///Z:/unity/learn-test/Assets/AssetBundles/cubes.unity3d", 22); 15 yield return www; 16 if(!string.IsNullOrEmpty (www.error)){//有些平臺不支持string為null,這種寫法可以避免意外 17 Debug.LogError (www.error); 18 yield break; 19 } 20 21 AssetBundle bundle = www.assetBundle; 22 23 //注意必須使用Instantiate實例化出來才能將兩個CUBE顯示到場景中 24 GameObject cube1 = Instantiate (bundle.LoadAsset ("DecalCube2")) as GameObject; 25 GameObject cube2 = Instantiate (bundle.LoadAsset ("DecalCube3")) as GameObject; 26 27 } 28 // Use this for initialization 29 void Start () { 30 StartCoroutine ("DownloadAndCache"); 31 } 32 33 // Update is called once per frame 34 void Update () { 35 36 } 37 }

?

posted on 2016-10-22 12:50 時空觀察者9號 閱讀(...) 評論(...) 編輯 收藏

總結

以上是生活随笔為你收集整理的U3D assetbundle加载的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。