EllanJiang/GameFramework · error · GameFrameworkException

You can not verify resources at this time.

Error message

You can not verify resources at this time.

What it means

Thrown by ResourceManager.VerifyResources when m_RefuseSetFlag is true, meaning a state-changing operation (like CheckResources or ApplyResources) is already in progress and the flag set is temporarily locked. Verifying resources concurrently would corrupt the pending operation's state.

Solutions

  1. Wait for the in-progress operation's complete callback before calling VerifyResources.
  2. Disable the UI entry point while m_RefuseSetFlag-equivalent state indicates a pending operation.
  3. Queue the verify request and execute it after the current operation finishes.

Example fix

// before
m_ResourceManager.CheckResources(false, OnCheckComplete);
m_ResourceManager.VerifyResources(1024 * 1024, OnVerifyComplete); // throws
// after
m_ResourceManager.CheckResources(false, (removed, total) => {
    m_ResourceManager.VerifyResources(1024 * 1024, OnVerifyComplete);
});
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: Calling VerifyResources while a CheckResources or ApplyResources operation is running (their bodies set m_RefuseSetFlag = true), or double-triggering verification in the same frame.

Common situations: User clicking 'check update' twice; UI code issuing CheckResources then VerifyResources without waiting for the first callback; auto-update logic racing manual verification.

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/01911da66a921482. Report an issue: GitHub.

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.cs:1198

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

View on GitHub (pinned to d0c010b051)