{"record":{"id":"9e1006cf0bda24fd","repo":"EllanJiang/GameFramework","slug":"you-can-not-use-updateretrycount-at-this-time","errorCode":null,"errorMessage":"You can not use UpdateRetryCount at this time.","messagePattern":"You can not use UpdateRetryCount at this time\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/ResourceManager.cs","lineNumber":368,"sourceCode":"            {\n                return m_ResourceUpdater != null ? m_ResourceUpdater.ApplyWaitingCount : 0;\n            }\n        }\n\n        /// <summary>\n        /// 获取或设置资源更新重试次数。\n        /// </summary>\n        public int UpdateRetryCount\n        {\n            get\n            {\n                return m_ResourceUpdater != null ? m_ResourceUpdater.UpdateRetryCount : 0;\n            }\n            set\n            {\n                if (m_ResourceUpdater == null)\n                {\n                    throw new GameFrameworkException(\"You can not use UpdateRetryCount at this time.\");\n                }\n\n                m_ResourceUpdater.UpdateRetryCount = value;\n            }\n        }\n\n        /// <summary>\n        /// 获取正在更新的资源组。\n        /// </summary>\n        public IResourceGroup UpdatingResourceGroup\n        {\n            get\n            {\n                return m_ResourceUpdater != null ? m_ResourceUpdater.UpdatingResourceGroup : null;\n            }\n        }\n\n        /// <summary>","sourceCodeStart":350,"sourceCodeEnd":386,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.cs#L350-L386","documentation":"The ResourceManager.UpdateRetryCount property setter throws this when m_ResourceUpdater is null. Like other update-only settings, UpdateRetryCount lives on the ResourceUpdater, which is only instantiated once the resource system initializes the update pipeline.","triggerScenarios":"Setting UpdateRetryCount before the ResourceUpdater exists — i.e. before the resource system enters an updatable resource mode.","commonSituations":"Applying a settings preset at startup that includes retry counts while running in package-only mode; calling the setter earlier in Awake than the resource mode initialization.","solutions":["Set UpdateRetryCount only after the resource updater has been created (post mode initialization).","Guard with a resource-mode check and skip the assignment in non-updatable modes.","Defer the assignment to the point in your bootstrap where update settings are valid."],"exampleFix":"// before\nm_ResourceManager.UpdateRetryCount = 3; // updater not created yet\n// after\nif (m_ResourceManager.ResourceMode == ResourceMode.Updatable)\n{\n    m_ResourceManager.UpdateRetryCount = 3;\n}","handlingStrategy":"validation","validationCode":"// C#\nif (m_ResourceManager.ResourceMode == ResourceMode.Updatable)\n{\n    m_ResourceManager.UpdateRetryCount = 3;\n}","typeGuard":null,"tryCatchPattern":"// C#\ntry\n{\n    m_ResourceManager.UpdateRetryCount = retryCount;\n}\ncatch (GameFrameworkException ex) when (ex.Message.Contains(\"UpdateRetryCount\"))\n{\n    // defer setting until update mode is active\n}","preventionTips":["Set retry counts only once the resource updater has been created.","Keep update-only settings out of package-only mode presets.","Gate all ResourceUpdater-backed properties behind a single mode check helper."],"tags":["gameframework","resource-manager","wrong-lifecycle-phase","property-setter"],"backgroundTag":"unsupported-operation","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"}