콘텐츠가 시작되기 전에 모든 에셋 데이터를 다운로드해야 하므로 에셋을 메인 데이터 파일에서 AssetBundles
로 이동하는 것이 좋습니다.에셋을 AssetBundles
로 이동하면 사용자가 콘텐츠를 진행하면서 필요에 따라 에셋을 동적으로 로드하는 콘텐츠용 작은 로더 씬을 생성할 수 있습니다.AssetBundles
는 에셋 데이터 메모리 관리에도 도움이 됩니다.AssetBundle.Unload를 호출하여 더 이상 필요하지 않은 에셋의 메모리에서 에셋 데이터를 언로드할 수 있습니다.
WebGL 플랫폼에서 AssetBundles
를 사용할 때 다음 고려 사항을 적용하십시오.
에셋 번들에서 메인 빌드에 사용되지 않는 클래스 타입을 사용하면 Unity는 이러한 클래스의 코드를 빌드에서 제거할 수도 있습니다.이로 인해 에셋 번들에서 에셋을 로드하려고 할 때 장애가 발생할 수 있습니다.이 문제를 해결하려면 BuildPlayerOptions.assetBundleManifestPath를 사용하거나 배포 크기 및 코드 스트리핑에서 다른 옵션을 참조하십시오.
WebGL은 스레딩을 지원하지 않습니다.HTTP 다운로드는 다운로드가 완료된 후에만 사용할 수 있으므로 Unity WebGL 빌드는 다운로드가 완료된 후 메인 스레드에서 에셋 번들 데이터의 압축을 풀고 메인 스레드를 차단해야 합니다.이러한 중단을 방지하기 위해 WebGL의 에셋 번들에는 LZMA 에셋 번들 압축을 사용할 수 없으며, 대신 온디맨드 방식으로 효율적으로 압축을 해제하는 LZ4를 사용하여 압축합니다.LZ4가 제공하는 것보다 압축 크기를 더 작게 해야 하는 경우, 에셋 번들에서 (LZ4 압축 외에) gzip 또는 Brotli 압축을 사용하도록 웹 서버를 설정하면 됩니다.이렇게 하는 방법에 대한 자세한 내용은 압축된 빌드 배포를 참조하십시오.
WebGL은 UnityWebRequestAssetBundle.GetAssetBundle을 통해 AssetBundle
캐싱을 지원합니다.이 메서드는 브라우저의 IndexedDB
API를 사용하여 사용자의 기기에 캐시를 저장합니다.일부 브라우저는 IndexedDB
를 제한적으로 지원할 수 있으며 모든 브라우저는 디스크에 데이터를 저장하기 위해 사용자의 권한을 요청할 수 있습니다.자세한 내용은 WebGL 브라우저 호환성을 참조하십시오.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.