{"record":{"id":"e6f9ce88e1e201b8","repo":"EllanJiang/GameFramework","slug":"you-can-not-use-updateresources-without-updatable-resource","errorCode":null,"errorMessage":"You can not use UpdateResources without updatable resource mode.","messagePattern":"You can not use UpdateResources without updatable resource mode\\.","errorType":"validation","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/ResourceManager.cs","lineNumber":1311,"sourceCode":"        /// 使用可更新模式并更新指定资源组的资源。\n        /// </summary>\n        /// <param name=\"resourceGroupName\">要更新的资源组名称。</param>\n        /// <param name=\"updateResourcesCompleteCallback\">使用可更新模式并更新指定资源组完成时的回调函数。</param>\n        public void UpdateResources(string resourceGroupName, UpdateResourcesCompleteCallback updateResourcesCompleteCallback)\n        {\n            if (updateResourcesCompleteCallback == null)\n            {\n                throw new GameFrameworkException(\"Update 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 UpdateResources without updatable resource mode.\");\n            }\n\n            if (m_ResourceUpdater == null)\n            {\n                throw new GameFrameworkException(\"You can not use UpdateResources at this time.\");\n            }\n\n            ResourceGroup resourceGroup = (ResourceGroup)GetResourceGroup(resourceGroupName);\n            if (resourceGroup == null)\n            {\n                throw new GameFrameworkException(Utility.Text.Format(\"Can not find resource group '{0}'.\", resourceGroupName));\n            }\n\n            m_UpdateResourcesCompleteCallback = updateResourcesCompleteCallback;\n            m_ResourceUpdater.UpdateResources(resourceGroup);\n        }\n\n        /// <summary>","sourceCodeStart":1293,"sourceCodeEnd":1329,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.cs#L1293-L1329","documentation":"This GameFrameworkException is thrown by ResourceManager.UpdateResources when the current ResourceMode is not Updatable or UpdatableWhilePlaying (e.g. Package mode). Updating resource groups over the network only works in updatable modes, so the call is rejected otherwise. It is a mode-compatibility guard.","triggerScenarios":"Calling UpdateResources in ResourceMode.Package builds; configurations where hot-update was disabled but update code still executes; shared update code invoked regardless of mode.","commonSituations":"Publishing a non-updatable build that still runs the update screen; mode selected from config/environment that differs from the code path; testers switching modes without guarding call sites.","solutions":["Use ResourceMode.Updatable or ResourceMode.UpdatableWhilePlaying when network resource updates are required.","Check ResourceManager.ResourceMode before calling UpdateResources and skip/handle non-updatable modes.","Remove update calls from Package-mode build paths (e.g. via conditional compilation or config)."],"exampleFix":"// before\nresourceManager.UpdateResources(\"MyGroup\", callback);\n// after\nif (resourceManager.ResourceMode == ResourceMode.Updatable || resourceManager.ResourceMode == ResourceMode.UpdatableWhilePlaying)\n{\n    resourceManager.UpdateResources(\"MyGroup\", callback);\n}","handlingStrategy":"validation","validationCode":"var mode = resourceManager.ResourceMode;\nif (mode != ResourceMode.Updatable && mode != ResourceMode.UpdatableWhilePlaying) return;","typeGuard":"bool IsUpdatableMode(ResourceMode m) => m == ResourceMode.Updatable || m == ResourceMode.UpdatableWhilePlaying;","tryCatchPattern":"try { resourceManager.UpdateResources(groupName, callback); }\ncatch (GameFrameworkException ex) when (ex.Message.Contains(\"updatable resource mode\")) { UnityEngine.Debug.LogWarning(\"UpdateResources requires an updatable resource mode.\"); }","preventionTips":["Only ship update flow in updatable-mode builds.","Check ResourceMode before invoking update APIs.","Keep mode selection and update code paths aligned via config."],"tags":["csharp","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-16T04:17:20.429Z"}