찾기
내용으로 건너뛰기
추적
문서의 이전 판을 선택했습니다!
저장하면 이 자료로 새 판을 만듭니다.
미디어 파일
=====Downloading AssetBundles===== This section assumes you already learned how to build asset bundles. If you have not, please see [[BuildingAssetBundles|Building AssetBundles]] There are two ways to download an AssetBundle - _Non-caching:_ This is done using a creating a new [[ScriptRef:WWW.WWW.html|WWW object]]. The AssetBundles are not cached to Unitys Cache folder in the local storage device. - _Caching:_ This is done using the [[ScriptRef:WWW.LoadFromCacheOrDownload.html|WWW.LoadFromCacheOrDownload]] call. The AssetBundles are cached to Unitys Cache folder in the local storage device. The WebPlayer shared cache allows up to 50 MB of cached AssetBundles. PC/Mac Standalone applications and iOS/Android applications have a limit of 4 GB. WebPlayer applications that make use of a dedicated cache are limited to the number of bytes specified in the caching license agreement. Here's an example of a non-caching download: <file csharp>using System; using UnityEngine; using System.Collections; class NonCachingLoadExample : MonoBehaviour { public string BundleURL; public string AssetName; IEnumerator Start() { using (WWW www = new WWW(BundleURL)) { yield return www; if (www.error != null) throw new Exception("WWW download had an error:" + www.error); AssetBundle bundle = www.assetBundle; if (AssetName == "") Instantiate(bundle.mainAsset); else Instantiate(bundle.Load(AssetName)); } } }</file> The recommended way to download AssetBundles is to use [[ScriptRef:WWW.LoadFromCacheOrDownload.html|WWW.LoadFromCacheOrDownload]]. For example: <file csharp>using System; using UnityEngine; using System.Collections; public class CachingLoadExample : MonoBehaviour { public string BundleURL; public string AssetName; public int version; IEnumerator Start() { using(WWW www = WWW.LoadFromCacheOrDownload (BundleURL, version)){ yield return www; if (www.error != null) throw new Exception("WWW download had an error:" + www.error); AssetBundle bundle = www.assetBundle; if (AssetName == "") Instantiate(bundle.mainAsset); else Instantiate(bundle.Load(AssetName)); } } }</file> When you access the ''.assetBundle'' property, the downloaded data is extracted and the AssetBundle object is created. At this point, you are ready to load the objects contained in the bundle. The second parameter passed to LoadFromCacheOrDownload specifies which version of the AssetBundle to download. If the AssetBundle doesn't exist in the cache or has a version lower than requested, LoadFromCacheOrDownload will download the AssetBundle. Otherwise the AssetBundle will be loaded from cache. ====Putting it all together==== Now that the components are in place you can build a scene that will allow you to load your AssetBundle and display the contents on screen. ->{{:unity3d:AssetBundlesExampleFinalProject.png}} Final project structure First create an empty game object by going to **GameObject->CreateEmpty**. Drag the CachingLoadExample script onto the empty game object you just created. Then type the the URL of your AssetBundle in the BundleURL field. As we have placed this in the project directory you can copy the file directory location and add the prefix ''file://'', for example ''file://C:/UnityProjects/AssetBundlesGuide/Assets/AssetBundles/Cube.unity3d'' You can now hit play in the Editor and you should see the Cube prefab being loaded from the AssetBundle. This is the end of the basic example of how to build and use an AssetBundle. [[AssetBundlesIntro|back to AssetBundles Intro]] {{tag>유니티 unity}} * 출처: [[http://unitykoreawiki.com/index.php?n=KrMain.DownloadingAssetBundles|유니티코리아위키]] (CC BY-NC-SA 2.0)
2+1?
이 필드는 비어 있도록 유지하세요:
저장
미리 보기
취소
편집 요약
참고: 이 문서를 편집하면 내용은 다음 라이선스에 따라 배포하는 데 동의하는 것으로 간주합니다:
CC Attribution-Noncommercial-Share Alike 4.0 International
연결문서
AssetBundles (Pro only)
Building AssetBundles
유니티3D ( Unity3D )
문서 도구
문서 보기
이전 판
연결문서
맨 위로
다크 모드로 보기
☀️
Toggle Menu
유니티3D ( Unity3D )
너두 고쳐두 됩니다.
사이트 도구
최근 바뀜
미디어 관리자
사이트맵
사용자 도구
등록
로긴
최근 수정된 문서
misuse_topical5
노박
unique_items
dinner_bell
deputy_beagle
ratslayer
one_for_my_baby
alerio
power_fist
제거됨
fixer
climb_ev_ry_mountain
companion
[장비 분실]
crashed_vertibird
brotherhood_t-51b_power_armor
marco
i_forgot_to_remember_to_forget
cateye