{"record":{"id":"49f5d0d6794928cf","repo":"EllanJiang/GameFramework","slug":"you-can-not-use-verifyresources-without-updatable-resource","errorCode":null,"errorMessage":"You can not use VerifyResources without updatable resource mode.","messagePattern":"You can not use VerifyResources without updatable resource mode\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/ResourceManager.cs","lineNumber":1193,"sourceCode":"        /// 使用可更新模式并校验资源。\n        /// </summary>\n        /// <param name=\"verifyResourceLengthPerFrame\">每帧至少校验资源的大小，以字节为单位。</param>\n        /// <param name=\"verifyResourcesCompleteCallback\">使用可更新模式并校验资源完成时的回调函数。</param>\n        public void VerifyResources(int verifyResourceLengthPerFrame, VerifyResourcesCompleteCallback verifyResourcesCompleteCallback)\n        {\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        /// 使用可更新模式并检查资源。","sourceCodeStart":1175,"sourceCodeEnd":1211,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.cs#L1175-L1211","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Switch to ResourceMode.Updatable or UpdatableWhilePlaying before calling VerifyResources.","Gate the VerifyResources call behind a check: if (mode is Updatable or UpdatableWhilePlaying).","Remove VerifyResources calls from package-mode build variants."],"exampleFix":"// before\nm_ResourceManager.VerifyResources(1024 * 1024, OnComplete);\n// after\nif (m_ResourceMode == ResourceMode.Updatable || m_ResourceMode == ResourceMode.UpdatableWhilePlaying) {\n    m_ResourceManager.VerifyResources(1024 * 1024, OnComplete);\n}","handlingStrategy":"validation","validationCode":"if (m_ResourceManager.ResourceMode == ResourceMode.Unspecified) {\n    throw new InvalidOperationException(\"Set resource mode before VerifyResources\");\n}\nm_ResourceManager.VerifyResources(len, cb);","typeGuard":"bool IsResourceModeReady(ResourceMode mode) => mode != ResourceMode.Unspecified;","tryCatchPattern":"try { m_ResourceManager.VerifyResources(len, cb); } catch (GameFrameworkException ex) { Log.Error(ex.Message); }","preventionTips":["Call VerifyResources only from the resource component's initialization-complete callback.","Configure ResourceMode in the inspector or bootstrap before any update logic.","Centralize the update flow in one state machine."],"tags":["unity","gameframework","resource-mode","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"d0c010b05167c58e92350449d04864a91ca13fd2","analyzedAt":"2026-09-15T13:37:15.352Z","contentChangedAt":"2026-09-15T13:37:15.352Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}