Version: 2023.2
언어: 한국어
커스텀 에셋 팩 생성
Android용 그래픽스

런타임 시 에셋 팩 관리

Unity provides APIs to manage asset packs at runtime. They use Google’s PlayCore API, which means they have the same limitations as PlayCore, and can’t manage install-time asset packs. Using the PlayCore API also means your application requires the PlayCore plug-in. If your project has asset packs, either custom asset packs or Unity-generated asset packs, Unity automatically adds the PlayCore dependency to the application’s manifest.

에셋 팩을 다운로드하고 에셋에 액세스하는 방법은 에셋 팩 전송 모드에 따라 다릅니다. 에셋 팩 전송 모드에는 다음과 같이 세 가지 방법이 있습니다.

  • install-time: Google Play는 기기가 애플리케이션을 설치할 때 자동으로 install-time 에셋 팩을 다운로드합니다. Google Play는 이러한 에셋 팩을 기본 애플리케이션의 일부로 인식하며 최종 사용자는 전체 애플리케이션을 제거하지 않고는 이 에셋 팩을 제거할 수 없습니다. PlayCore API는 install-time 에셋 팩을 처리하지 않으므로 상태를 확인하거나 다운로드 요청 또는 install-time 에셋 팩을 제거할 수 없습니다. 또한 Unity에서 생성한 install-time 에셋 팩에 있는 스트리밍 에셋을 제외하고 이러한 에셋 팩 안에 있는 에셋에 직접 액세스할 수 없습니다. 스트리밍 에셋에 액세스하려면 Application.streamingAssetsPath를 사용하여 스트리밍 에셋 위치에 대한 경로를 찾은 다음 UnityWebRequest를 사용하여 해당 경로에 있는 에셋에 액세스합니다. 커스텀 에셋 팩을 생성하는 경우 표준 파일 API를 사용하여 안에 있는 에셋에 액세스할 수 없습니다. 대신 Android의 AssetManager API를 사용합니다.
  • fast-follow: Google Play automatically starts to download fast-follow asset packs after it installs the application. However, it’s possible that not all fast-follow asset packs are available on the first time the application launches. To check the status and download fast-follow asset packs, refer to Download asset packs.
  • on-demand: Google Play doesn’t automatically download on-demand asset packs. You have to manually start the download. For information on how to do this, refer to Download asset packs.

For more information about delivery modes, refer to Delivery modes.

에셋 팩 다운로드

If your application uses fast-follow or on-demand asset packs, the device must download these asset packs before the application can access assets inside of them. To check the status of asset packs and download them if they’re not on the device, you must first know the name of each asset pack. To get the names of Unity-generated asset packs, call AndroidAssetPacks.GetCoreUnityAssetPackNames. There is no runtime API to get the names of custom asset packs so you must keep track of them yourself. You set the name of custom asset packs at build time; it’s the name of the directory.

After you have the names of your asset packs, to check the status of each asset pack, call AndroidAssetPacks.GetAssetPackStateAsync, passing in the asset pack name. This returns the status of the asset pack you query, and you can use the result to determine whether you need to download the asset pack. If you want to quickly query the status of every Unity-generated asset pack, you can use AndroidAssetPacks.coreUnityAssetPacksDownloaded. This helps you to ensure that every Unity-generated asset pack is available before you load any scene other than the first one or try to access other resources that Unity handles.

다운로드해야 하는 모든 에셋 팩의 경우 AndroidAssetPacks.DownloadAssetPackAsync를 호출하여 해당 에셋 팩의 이름을 입력합니다. 에셋 팩을 다운로드하는 동안 다운로드가 일시 정지되거나 중단될 수 있기 때문에 다운로드 상태를 모니터링해야 합니다. 이를 수행하는 데는 두 가지 방법이 있습니다.

추가 리소스

커스텀 에셋 팩 생성
Android용 그래픽스
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961