Пример #1
0
        /// <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_LoadResourcesOperation = Addressables.LoadResourceLocationsAsync(new object[] { localeLabel, LocalizationSettings.PreloadLabel }, Addressables.MergeMode.Intersection, typeof(TTable));

            if (!m_LoadResourcesOperation.IsDone)
            {
                m_LoadResourcesOperation.Completed += LoadTables;
            }
            else
            {
                LoadTables(m_LoadResourcesOperation);
            }
        }