/// <summary> /// We need to check if there are any resources to preload. If we call Load when there is nothing to load an error will be thrown. /// </summary> /// <returns></returns> void BeginPreloading() { m_Database.TableOperations.Clear(); m_Database.SharedTableDataOperations.Clear(); var selectedLocale = LocalizationSettings.SelectedLocale; if (selectedLocale == null) { Complete(m_Database, true, null); return; } m_Progress = 0; var localeLabel = AddressHelper.FormatAssetLabel(selectedLocale.Identifier); m_ResourceLabels.Clear(); m_ResourceLabels.Add(localeLabel); m_ResourceLabels.Add(LocalizationSettings.PreloadLabel); m_LoadResourcesOperation = AddressablesInterface.LoadResourceLocationsWithLabelsAsync(m_ResourceLabels, Addressables.MergeMode.Intersection, typeof(TTable)); if (!m_LoadResourcesOperation.IsDone) { CurrentOperation = m_LoadResourcesOperation; m_LoadResourcesOperation.Completed += LoadTables; } else { LoadTables(m_LoadResourcesOperation); } }
/// <summary> /// We need to check if there are any resources to preload. If we call Load when there is nothing to load an error will be thrown. /// </summary> /// <returns></returns> void BeginPreloading() { var selectedLocale = LocalizationSettings.SelectedLocale; if (selectedLocale == null) { Debug.LogError("Can not preload when `LocalizationSettings.SelectedLocale` is null."); return; } m_Progress = 0; var localeLabel = AddressHelper.FormatAssetLabel(selectedLocale.Identifier); m_ResourceKeys.Clear(); m_ResourceKeys.Add(localeLabel); m_ResourceKeys.Add(LocalizationSettings.PreloadLabel); m_LoadResourcesOperation = AddressablesInterface.LoadResourceLocationsAsync(m_ResourceKeys, Addressables.MergeMode.Intersection, typeof(TTable)); if (!m_LoadResourcesOperation.IsDone) { m_LoadResourcesOperation.Completed += LoadTables; } else { LoadTables(m_LoadResourcesOperation); } }