EllanJiang/GameFramework · error · GameFrameworkException

You can not use VerifyResources without updatable resource…

Error message

You can not use VerifyResources without updatable resource mode.

What it means

Thrown by ResourceManager.VerifyResources when the resource mode is neither Updatable nor UpdatableWhilePlaying. Verification (checking local resource integrity against a remote version list) only applies to updatable modes; in package modes there is nothing to verify.

Solutions

  1. Switch to ResourceMode.Updatable or UpdatableWhilePlaying before calling VerifyResources.
  2. Gate the VerifyResources call behind a check: if (mode is Updatable or UpdatableWhilePlaying).
  3. Remove VerifyResources calls from package-mode build variants.

Example fix

// before
m_ResourceManager.VerifyResources(1024 * 1024, OnComplete);
// after
if (m_ResourceMode == ResourceMode.Updatable || m_ResourceMode == ResourceMode.UpdatableWhilePlaying) {
    m_ResourceManager.VerifyResources(1024 * 1024, OnComplete);
}
Defensive patterns

Strategy: validation

Validate before calling

if (m_ResourceManager.ResourceMode == ResourceMode.Unspecified) {
    throw new InvalidOperationException("Set resource mode before VerifyResources");
}
m_ResourceManager.VerifyResources(len, cb);

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: Calling VerifyResources while m_ResourceMode is Package (or another non-updatable mode), e.g. after switching build mode to Package for a store build and leaving old VerifyResources calls in code.

Common situations: Shipping builds configured with ResourceMode.Package but test code still triggering verification; config mismatch between editor and device builds; QA toggles changing resource mode at runtime.

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/49f5d0d6794928cf. Report an issue: GitHub.

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.cs:1193

        /// 使用可更新模式并校验资源。
        /// </summary>
        /// <param name="verifyResourceLengthPerFrame">每帧至少校验资源的大小,以字节为单位。</param>
        /// <param name="verifyResourcesCompleteCallback">使用可更新模式并校验资源完成时的回调函数。</param>
        public void VerifyResources(int verifyResourceLengthPerFrame, VerifyResourcesCompleteCallback verifyResourcesCompleteCallback)
        {
            if (verifyResourcesCompleteCallback == null)
            {
                throw new GameFrameworkException("Verify 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 VerifyResources without updatable resource mode.");
            }

            if (m_RefuseSetFlag)
            {
                throw new GameFrameworkException("You can not verify resources at this time.");
            }

            m_ResourceVerifier = new ResourceVerifier(this);
            m_ResourceVerifier.ResourceVerifyStart += OnVerifierResourceVerifyStart;
            m_ResourceVerifier.ResourceVerifySuccess += OnVerifierResourceVerifySuccess;
            m_ResourceVerifier.ResourceVerifyFailure += OnVerifierResourceVerifyFailure;
            m_ResourceVerifier.ResourceVerifyComplete += OnVerifierResourceVerifyComplete;
            m_VerifyResourcesCompleteCallback = verifyResourcesCompleteCallback;
            m_ResourceVerifier.VerifyResources(verifyResourceLengthPerFrame);
        }

        /// <summary>
        /// 使用可更新模式并检查资源。

View on GitHub (pinned to d0c010b051)