EllanJiang/GameFramework · error · GameFrameworkException

You can not use CheckResources at this time.

Error message

You can not use CheckResources at this time.

What it means

Thrown by ResourceManager.CheckResources when m_ResourceChecker is null. The ResourceChecker is created during resource initialization for updatable modes; if it is missing, the manager cannot perform a check, typically meaning initialization was not completed for the current mode.

Solutions

  1. Ensure the full resource initialization (including version list load) completed before CheckResources.
  2. Re-run resource initialization if a previous operation failed mid-way.
  3. Check that no prior exception left the manager half-initialized; restart the state machine.

Example fix

// before
m_ResourceManager.CheckResources(false, OnComplete); // checker may be null
// after
if (m_ResourceInitialized) {
    m_ResourceManager.CheckResources(false, OnComplete);
} else {
    m_ResourceComponent.InitResources(OnInitialized);
}
Defensive patterns

Strategy: validation

Validate before calling

var mode = m_ResourceManager.ResourceMode;
if (mode != ResourceMode.Updatable && mode != ResourceMode.UpdatableWhilePlaying) return;
m_ResourceManager.CheckResources(ignoreOtherVariant, cb);

Type guard

bool IsUpdatableMode(ResourceMode m) => m == ResourceMode.Updatable || m == ResourceMode.UpdatableWhilePlaying;

Try / catch

try { m_ResourceManager.CheckResources(ignore, cb); } catch (GameFrameworkException ex) { Log.Error(ex.Message); }

Prevention

When it happens

Trigger: Calling CheckResources when the resource checker was never instantiated (initialization incomplete, m_RefuseSetFlag path cleared it, or a previous operation reset state), even though the resource mode is updatable.

Common situations: Re-entering the update flow after a failed/partial initialization; calling CheckResources before the version-list setup step; state machine restarts that skip checker creation.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.cs:1234

        {
            if (checkResourcesCompleteCallback == null)
            {
                throw new GameFrameworkException("Check resources complete callback is invalid.");
            }

            if (m_ResourceMode == ResourceMode.Unspecified)
            {
                throw new GameFrameworkException("You must set resource mode first.");
            }

            if (m_ResourceMode != ResourceMode.Updatable && m_ResourceMode != ResourceMode.UpdatableWhilePlaying)
            {
                throw new GameFrameworkException("You can not use CheckResources without updatable resource mode.");
            }

            if (m_ResourceChecker == null)
            {
                throw new GameFrameworkException("You can not use CheckResources at this time.");
            }

            m_RefuseSetFlag = true;
            m_CheckResourcesCompleteCallback = checkResourcesCompleteCallback;
            m_ResourceChecker.CheckResources(m_CurrentVariant, ignoreOtherVariant);
        }

        /// <summary>
        /// 使用可更新模式并应用资源包资源。
        /// </summary>
        /// <param name="resourcePackPath">要应用的资源包路径。</param>
        /// <param name="applyResourcesCompleteCallback">使用可更新模式并应用资源包资源完成时的回调函数。</param>
        public void ApplyResources(string resourcePackPath, ApplyResourcesCompleteCallback applyResourcesCompleteCallback)
        {
            if (string.IsNullOrEmpty(resourcePackPath))
            {
                throw new GameFrameworkException("Resource pack path is invalid.");
            }

View on GitHub (pinned to d0c010b051)