void DownloadRemoteAssetPack(string assetPackName) { // Note that most methods in the AndroidAssetPacks class are either direct wrappers of java APIs in Google's PlayCore plugin, // or depend on values that the PlayCore API returns. If the PlayCore plugin is missing, calling these methods will throw an InvalidOperationException exception. try { AndroidAssetPacks.DownloadAssetPackAsync(new string[] { assetPackName }, CheckDownloadStatus); } catch (InvalidOperationException ioe) { Debug.LogError($"Cannot retrieve state for asset pack '{assetPackName}'. PlayCore Plugin is not installed: {ioe.Message}"); m_ProviderInterface.Complete(this, false, new Exception("exception")); } }
void LoadFromAssetPacksIfAvailable() { if (AndroidAssetPacks.coreUnityAssetPacksDownloaded) { // Core Unity asset packs use install-time delivery and are already installed. DownloadCustomAssetPacksData(); } else { // Core Unity asset packs use fast-follow or on-demand delivery and need to be downloaded. string[] coreUnityAssetPackNames = AndroidAssetPacks.GetCoreUnityAssetPackNames(); // only returns names of asset packs that are fast-follow or on-demand delivery if (coreUnityAssetPackNames.Length == 0) { CompleteOverride("Cannot retrieve core Unity asset pack names. PlayCore Plugin is not installed."); } else { AndroidAssetPacks.DownloadAssetPackAsync(coreUnityAssetPackNames, CheckDownloadStatus); } } }