{"record":{"id":"01911da66a921482","repo":"EllanJiang/GameFramework","slug":"you-can-not-verify-resources-at-this-time","errorCode":null,"errorMessage":"You can not verify resources at this time.","messagePattern":"You can not verify resources at this time\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/ResourceManager.cs","lineNumber":1198,"sourceCode":"        {\n            if (verifyResourcesCompleteCallback == null)\n            {\n                throw new GameFrameworkException(\"Verify resources complete callback is invalid.\");\n            }\n\n            if (m_ResourceMode == ResourceMode.Unspecified)\n            {\n                throw new GameFrameworkException(\"You must set resource mode first.\");\n            }\n\n            if (m_ResourceMode != ResourceMode.Updatable && m_ResourceMode != ResourceMode.UpdatableWhilePlaying)\n            {\n                throw new GameFrameworkException(\"You can not use VerifyResources without updatable resource mode.\");\n            }\n\n            if (m_RefuseSetFlag)\n            {\n                throw new GameFrameworkException(\"You can not verify resources at this time.\");\n            }\n\n            m_ResourceVerifier = new ResourceVerifier(this);\n            m_ResourceVerifier.ResourceVerifyStart += OnVerifierResourceVerifyStart;\n            m_ResourceVerifier.ResourceVerifySuccess += OnVerifierResourceVerifySuccess;\n            m_ResourceVerifier.ResourceVerifyFailure += OnVerifierResourceVerifyFailure;\n            m_ResourceVerifier.ResourceVerifyComplete += OnVerifierResourceVerifyComplete;\n            m_VerifyResourcesCompleteCallback = verifyResourcesCompleteCallback;\n            m_ResourceVerifier.VerifyResources(verifyResourceLengthPerFrame);\n        }\n\n        /// <summary>\n        /// 使用可更新模式并检查资源。\n        /// </summary>\n        /// <param name=\"ignoreOtherVariant\">是否忽略处理其它变体的资源，若不忽略，将会移除其它变体的资源。</param>\n        /// <param name=\"checkResourcesCompleteCallback\">使用可更新模式并检查资源完成时的回调函数。</param>\n        public void CheckResources(bool ignoreOtherVariant, CheckResourcesCompleteCallback checkResourcesCompleteCallback)\n        {","sourceCodeStart":1180,"sourceCodeEnd":1216,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.cs#L1180-L1216","documentation":"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.","triggerScenarios":"Calling VerifyResources while a CheckResources or ApplyResources operation is running (their bodies set m_RefuseSetFlag = true), or double-triggering verification in the same frame.","commonSituations":"User clicking 'check update' twice; UI code issuing CheckResources then VerifyResources without waiting for the first callback; auto-update logic racing manual verification.","solutions":["Wait for the in-progress operation's complete callback before calling VerifyResources.","Disable the UI entry point while m_RefuseSetFlag-equivalent state indicates a pending operation.","Queue the verify request and execute it after the current operation finishes."],"exampleFix":"// before\nm_ResourceManager.CheckResources(false, OnCheckComplete);\nm_ResourceManager.VerifyResources(1024 * 1024, OnVerifyComplete); // throws\n// after\nm_ResourceManager.CheckResources(false, (removed, total) => {\n    m_ResourceManager.VerifyResources(1024 * 1024, OnVerifyComplete);\n});","handlingStrategy":"validation","validationCode":"var mode = m_ResourceManager.ResourceMode;\nif (mode != ResourceMode.Updatable && mode != ResourceMode.UpdatableWhilePlaying) return;\nm_ResourceManager.VerifyResources(len, cb);","typeGuard":"bool IsUpdatableMode(ResourceMode m) => m == ResourceMode.Updatable || m == ResourceMode.UpdatableWhilePlaying;","tryCatchPattern":"try { m_ResourceManager.VerifyResources(len, cb); } catch (GameFrameworkException ex) { Log.Error(ex.Message); }","preventionTips":["Keep update-flow code out of package-mode builds via conditional compilation.","Assert mode at the entry of your update pipeline.","Sync build config (Package vs Updatable) with code paths."],"tags":["unity","gameframework","concurrency","state-conflict"],"backgroundTag":"invalid-state-transition","analyzedSha":"d0c010b05167c58e92350449d04864a91ca13fd2","analyzedAt":"2026-09-15T13:37:15.352Z","contentChangedAt":"2026-09-15T13:37:15.352Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}