콘텐츠가 사용되기 전에 모든 에셋 데이터를 미리 다운로드해야 하므로, 에셋을 기본 데이터 파일에서 에셋 번들로 옮기는 것이 좋습니다. 이렇게 하면 사용자가 콘텐츠를 진행하면서 필요에 따라 빠르게 로드되며 에셋을 동적으로 로드하는 작은 로더 씬을 콘텐츠용으로 만들 수 있습니다. 에셋 번들은 에셋 데이터 메모리 관리에도 도움이 됩니다. 더 이상 필요하지 않은 에셋에 대해서는 AssetBundle.Unload를 호출하여 메모리에서 에셋 데이터를 언로드할 수 있습니다.
WebGL 플랫폼에서 에셋 번들을 사용할 때 다음과 같은 고려해야 할 사항이 있습니다.
메인 빌드에서 사용되지 않는 클래스 타입을 에셋 번들에 사용하는 경우 Unity는 해당 클래스에 대한 코드를 빌드에서 스트리핑할 수 있습니다. 이로 인해 에셋 번들에서 에셋을 로드하려고 할 때 실패할 수 있습니다. 이 문제를 해결하려면 BuildPlayerOptions.assetBundleManifestPath를 사용하고, 다른 옵션의 경우 배포 크기 및 코드 스트리핑을 참조하십시오.
WebGL doesn’t support threading. As Http downloads become available only after they’re downloaded, Unity WebGL builds need to decompress AssetBundle data on the main thread after the download is complete, blocking the main thread. To avoid this interruption, LZMA AssetBundle compression isn’t available for AssetBundles on WebGL. AssetBundles are compressed using LZ4 instead, which is de-compressed efficiently on-demand. If you need smaller compression sizes than LZ4 delivers, you can configure your web server to use gzip or Brotli compression (on top of LZ4 compression) on your AssetBundles. See documentation on Deploying compressed builds for more information on how to do this.
WebGL does not support file-system based AssetBundle caching with UnityWebRequestAssetBundle.GetAssetBundle. Instead the WebRequest responses are cached by the browser, see Cache behavior in WebGL for details. This means that the entire AssetBundle file is held in memory when an AssetBundle is loaded, and care must be taken to promptly unload unused AssetBundles, especially when they are large.
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.