{"record":{"id":"3f26c80f00a47a5f","repo":"EllanJiang/GameFramework","slug":"you-can-not-use-checkresources-at-this-time","errorCode":null,"errorMessage":"You can not use CheckResources at this time.","messagePattern":"You can not use CheckResources at this time\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/ResourceManager.cs","lineNumber":1234,"sourceCode":"        {\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)\n        {\n            if (string.IsNullOrEmpty(resourcePackPath))\n            {\n                throw new GameFrameworkException(\"Resource pack path is invalid.\");\n            }","sourceCodeStart":1216,"sourceCodeEnd":1252,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.cs#L1216-L1252","documentation":"Thrown by ResourceManager.CheckResources when m_ResourceChecker is null. The ResourceChecker is created during resource initialization for updatable modes; if it is missing, the manager cannot perform a check, typically meaning initialization was not completed for the current mode.","triggerScenarios":"Calling CheckResources when the resource checker was never instantiated (initialization incomplete, m_RefuseSetFlag path cleared it, or a previous operation reset state), even though the resource mode is updatable.","commonSituations":"Re-entering the update flow after a failed/partial initialization; calling CheckResources before the version-list setup step; state machine restarts that skip checker creation.","solutions":["Ensure the full resource initialization (including version list load) completed before CheckResources.","Re-run resource initialization if a previous operation failed mid-way.","Check that no prior exception left the manager half-initialized; restart the state machine."],"exampleFix":"// before\nm_ResourceManager.CheckResources(false, OnComplete); // checker may be null\n// after\nif (m_ResourceInitialized) {\n    m_ResourceManager.CheckResources(false, OnComplete);\n} else {\n    m_ResourceComponent.InitResources(OnInitialized);\n}","handlingStrategy":"validation","validationCode":"var mode = m_ResourceManager.ResourceMode;\nif (mode != ResourceMode.Updatable && mode != ResourceMode.UpdatableWhilePlaying) return;\nm_ResourceManager.CheckResources(ignoreOtherVariant, cb);","typeGuard":"bool IsUpdatableMode(ResourceMode m) => m == ResourceMode.Updatable || m == ResourceMode.UpdatableWhilePlaying;","tryCatchPattern":"try { m_ResourceManager.CheckResources(ignore, cb); } catch (GameFrameworkException ex) { Log.Error(ex.Message); }","preventionTips":["Gate hot-update code paths on resource mode.","Use build-time defines to exclude update flow from package builds.","Keep a single source of truth for the active resource mode."],"tags":["unity","gameframework","initialization-order","resource-checker"],"backgroundTag":"internal-invariant-violation","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"}