EllanJiang/GameFramework · error · GameFrameworkException

You must check resources complete first.

Error message

You must check resources complete first.

What it means

ResourceManager.ApplyResources throws this when UpdateResources/CheckResources has not completed before applying a resource pack. Applying a pack requires an up-to-date in-memory resource version list; the m_CheckResourcesComplete flag guards that precondition.

Solutions

  1. Wait for the CheckResources completion callback (or UpdateResources completion) before calling ApplyResources
  2. Gate ApplyResources behind the resource-check-complete event/flag in your flow
  3. If the manager was reinitialized, run CheckResources again before applying any pack

Example fix

// before
resourceManager.ApplyResources(packPath); // too early
// after
m_NeedApplyPack = packPath;
resourceManager.CheckResources(OnCheckResourcesComplete);
...
void OnCheckResourcesComplete(...) { if (m_NeedApplyPack != null) resourceManager.ApplyResources(m_NeedApplyPack); }
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure check completed first; gate behind your own flag
if (!m_ResourcesChecked) throw new InvalidOperationException("Call CheckResources and wait for completion before ApplyResources");

Try / catch

try { resourceManager.ApplyResources(packPath); } catch (GameFrameworkException ex) { Log.Error("ApplyResources called before check completed: " + ex.Message); }

Prevention

When it happens

Trigger: Calling ApplyResources(resourcePackPath) immediately after startup, before CheckResources completed and its completion callback fired; calling it from a scene-load path that skips resource checking.

Common situations: Applying a downloaded resource pack on app launch without waiting for the check-complete callback; calling ApplyResources from the wrong lifecycle hook; resetting the resource manager after the check and forgetting to re-check.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15). Data as JSON: /api/errors/e0e8a7a2ff999ef3. Report an issue: GitHub.

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.ResourceUpdater.cs:320

            /// <param name="needGenerateReadWriteVersionList">是否需要生成读写区版本资源列表。</param>
            public void CheckResourceComplete(bool needGenerateReadWriteVersionList)
            {
                m_CheckResourcesComplete = true;
                if (needGenerateReadWriteVersionList)
                {
                    GenerateReadWriteVersionList();
                }
            }

            /// <summary>
            /// 应用指定资源包的资源。
            /// </summary>
            /// <param name="resourcePackPath">要应用的资源包路径。</param>
            public void ApplyResources(string resourcePackPath)
            {
                if (!m_CheckResourcesComplete)
                {
                    throw new GameFrameworkException("You must check resources complete first.");
                }

                if (m_ApplyingResourcePackStream != null)
                {
                    throw new GameFrameworkException(Utility.Text.Format("There is already a resource pack '{0}' being applied.", m_ApplyingResourcePackPath));
                }

                if (m_UpdatingResourceGroup != null)
                {
                    throw new GameFrameworkException(Utility.Text.Format("There is already a resource group '{0}' being updated.", m_UpdatingResourceGroup.Name));
                }

                if (m_UpdateWaitingInfoWhilePlaying.Count > 0)
                {
                    throw new GameFrameworkException("There are already some resources being updated while playing.");
                }

                try

View on GitHub (pinned to d0c010b051)