{"record":{"id":"38e207d9f929ac47","repo":"EllanJiang/GameFramework","slug":"you-can-not-use-checkresources-without-updatable-resource","errorCode":null,"errorMessage":"You can not use CheckResources without updatable resource mode.","messagePattern":"You can not use CheckResources without updatable resource mode\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/ResourceManager.cs","lineNumber":1229,"sourceCode":"        /// 使用可更新模式并检查资源。\n        /// </summary>\n        /// <param name=\"ignoreOtherVariant\">是否忽略处理其它变体的资源，若不忽略，将会移除其它变体的资源。</param>\n        /// <param name=\"checkResourcesCompleteCallback\">使用可更新模式并检查资源完成时的回调函数。</param>\n        public void CheckResources(bool ignoreOtherVariant, CheckResourcesCompleteCallback checkResourcesCompleteCallback)\n        {\n            if (checkResourcesCompleteCallback == null)\n            {\n                throw new GameFrameworkException(\"Check 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 CheckResources without updatable resource mode.\");\n            }\n\n            if (m_ResourceChecker == null)\n            {\n                throw new GameFrameworkException(\"You can not use CheckResources at this time.\");\n            }\n\n            m_RefuseSetFlag = true;\n            m_CheckResourcesCompleteCallback = checkResourcesCompleteCallback;\n            m_ResourceChecker.CheckResources(m_CurrentVariant, ignoreOtherVariant);\n        }\n\n        /// <summary>\n        /// 使用可更新模式并应用资源包资源。\n        /// </summary>\n        /// <param name=\"resourcePackPath\">要应用的资源包路径。</param>\n        /// <param name=\"applyResourcesCompleteCallback\">使用可更新模式并应用资源包资源完成时的回调函数。</param>\n        public void ApplyResources(string resourcePackPath, ApplyResourcesCompleteCallback applyResourcesCompleteCallback)","sourceCodeStart":1211,"sourceCodeEnd":1247,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.cs#L1211-L1247","documentation":"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.","triggerScenarios":"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.","commonSituations":"Release builds built with Package mode but containing the hot-update flow; runtime mode switching without removing check calls; editor/device configuration drift.","solutions":["Use ResourceMode.Updatable or UpdatableWhilePlaying when the update flow is required.","Guard the call: only invoke CheckResources when mode is updatable.","Strip update-flow code from package-mode builds."],"exampleFix":"// before\nm_ResourceManager.CheckResources(false, OnComplete);\n// after\nvar mode = m_ResourceManager.ResourceMode;\nif (mode == ResourceMode.Updatable || mode == ResourceMode.UpdatableWhilePlaying) {\n    m_ResourceManager.CheckResources(false, OnComplete);\n}","handlingStrategy":"validation","validationCode":"if (m_ResourceManager.ResourceMode == ResourceMode.Unspecified) {\n    throw new InvalidOperationException(\"Initialize resource mode before CheckResources\");\n}\nm_ResourceManager.CheckResources(ignoreOtherVariant, cb);","typeGuard":"bool IsResourceModeReady(ResourceMode mode) => mode != ResourceMode.Unspecified;","tryCatchPattern":"try { m_ResourceManager.CheckResources(ignore, cb); } catch (GameFrameworkException ex) { Log.Error(ex.Message); }","preventionTips":["Trigger CheckResources from the resource init-complete callback only.","Set ResourceMode during bootstrap before update logic runs.","Validate scene setup contains an initialized ResourceComponent."],"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"}