EllanJiang/GameFramework · error · GameFrameworkException

You can not use CheckResources without updatable resource…

Error message

You can not use CheckResources without updatable resource mode.

What it means

Thrown by ResourceManager.CheckResources when the current resource mode is not Updatable or UpdatableWhilePlaying. Resource checking compares installed resources against a remote version list, an operation exclusive to updatable resource modes.

Solutions

  1. Use ResourceMode.Updatable or UpdatableWhilePlaying when the update flow is required.
  2. Guard the call: only invoke CheckResources when mode is updatable.
  3. Strip update-flow code from package-mode builds.

Example fix

// before
m_ResourceManager.CheckResources(false, OnComplete);
// after
var mode = m_ResourceManager.ResourceMode;
if (mode == ResourceMode.Updatable || mode == ResourceMode.UpdatableWhilePlaying) {
    m_ResourceManager.CheckResources(false, OnComplete);
}
Defensive patterns

Strategy: validation

Validate before calling

if (m_ResourceManager.ResourceMode == ResourceMode.Unspecified) {
    throw new InvalidOperationException("Initialize resource mode before CheckResources");
}
m_ResourceManager.CheckResources(ignoreOtherVariant, cb);

Type guard

bool IsResourceModeReady(ResourceMode mode) => mode != ResourceMode.Unspecified;

Try / catch

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

Prevention

When it happens

Trigger: Calling CheckResources with ResourceMode.Package (or any non-updatable mode) active, e.g. after a build-config change that switched to package mode while update code still runs.

Common situations: Release builds built with Package mode but containing the hot-update flow; runtime mode switching without removing check calls; editor/device configuration drift.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.cs:1229

        /// 使用可更新模式并检查资源。
        /// </summary>
        /// <param name="ignoreOtherVariant">是否忽略处理其它变体的资源,若不忽略,将会移除其它变体的资源。</param>
        /// <param name="checkResourcesCompleteCallback">使用可更新模式并检查资源完成时的回调函数。</param>
        public void CheckResources(bool ignoreOtherVariant, CheckResourcesCompleteCallback checkResourcesCompleteCallback)
        {
            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)

View on GitHub (pinned to d0c010b051)