{"record":{"id":"3d9d1ce2be2d71e7","repo":"EllanJiang/GameFramework","slug":"you-can-not-set-read-write-path-at-this-time","errorCode":null,"errorMessage":"You can not set read-write path at this time.","messagePattern":"You can not set read-write path at this time\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/ResourceManager.cs","lineNumber":890,"sourceCode":"            }\n\n            m_ReadOnlyPath = readOnlyPath;\n        }\n\n        /// <summary>\n        /// 设置资源读写区路径。\n        /// </summary>\n        /// <param name=\"readWritePath\">资源读写区路径。</param>\n        public void SetReadWritePath(string readWritePath)\n        {\n            if (string.IsNullOrEmpty(readWritePath))\n            {\n                throw new GameFrameworkException(\"Read-write path is invalid.\");\n            }\n\n            if (m_RefuseSetFlag)\n            {\n                throw new GameFrameworkException(\"You can not set read-write path at this time.\");\n            }\n\n            if (m_ResourceLoader.TotalAgentCount > 0)\n            {\n                throw new GameFrameworkException(\"You must set read-write path before add load resource agent helper.\");\n            }\n\n            m_ReadWritePath = readWritePath;\n        }\n\n        /// <summary>\n        /// 设置资源模式。\n        /// </summary>\n        /// <param name=\"resourceMode\">资源模式。</param>\n        public void SetResourceMode(ResourceMode resourceMode)\n        {\n            if (resourceMode == ResourceMode.Unspecified)\n            {","sourceCodeStart":872,"sourceCodeEnd":908,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.cs#L872-L908","documentation":"Thrown by ResourceManager.SetReadWritePath when m_RefuseSetFlag is set, meaning resource initialization has progressed past the point where paths may change (e.g. after CheckResources or on a read-only resource mode). Paths must be configured before the resource component begins initialization.","triggerScenarios":"Calling SetReadWritePath after ResourceManager initialization has completed and refused further configuration.","commonSituations":"Setting the path from a delayed callback, coroutine, or second scene load after the framework has initialized the resource component.","solutions":["Set the read-write path during startup before initialization completes","Remove redundant late setter calls","Configure via inspector/GameEntry bootstrap before init"],"exampleFix":"// before\nIEnumerator Start() { yield return Init(); resourceComponent.SetReadWritePath(p); } // refused\n// after\nvoid Awake() { resourceComponent.SetReadWritePath(p); }","handlingStrategy":"validation","validationCode":"if (!resourceComponent.Initialized) resourceComponent.SetReadWritePath(path); else Log.Warning(\"Too late to set read-write path\");","typeGuard":null,"tryCatchPattern":"try { resourceComponent.SetReadWritePath(path); }\ncatch (GameFrameworkException) { Log.Error(\"Read-write path must be set before resource initialization completes.\"); }","preventionTips":["Set all resource paths in the bootstrap phase only","Avoid configuring components from async callbacks","Use a single initialization entry point"],"tags":["gameframework","unity","resource","initialization-order"],"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-15T23:17:13.987Z"}