{"record":{"id":"0fec0f6a2e2d1649","repo":"EllanJiang/GameFramework","slug":"you-can-not-use-applyresources-at-this-time","errorCode":null,"errorMessage":"You can not use ApplyResources at this time.","messagePattern":"You can not use ApplyResources at this time\\.","errorType":"validation","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/ResourceManager.cs","lineNumber":1276,"sourceCode":"\n            if (applyResourcesCompleteCallback == null)\n            {\n                throw new GameFrameworkException(\"Apply 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 ApplyResources without updatable resource mode.\");\n            }\n\n            if (m_ResourceUpdater == null)\n            {\n                throw new GameFrameworkException(\"You can not use ApplyResources at this time.\");\n            }\n\n            m_ApplyResourcesCompleteCallback = applyResourcesCompleteCallback;\n            m_ResourceUpdater.ApplyResources(resourcePackPath);\n        }\n\n        /// <summary>\n        /// 使用可更新模式并更新所有资源。\n        /// </summary>\n        /// <param name=\"updateResourcesCompleteCallback\">使用可更新模式并更新默认资源组完成时的回调函数。</param>\n        public void UpdateResources(UpdateResourcesCompleteCallback updateResourcesCompleteCallback)\n        {\n            UpdateResources(string.Empty, updateResourcesCompleteCallback);\n        }\n\n        /// <summary>\n        /// 使用可更新模式并更新指定资源组的资源。\n        /// </summary>","sourceCodeStart":1258,"sourceCodeEnd":1294,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.cs#L1258-L1294","documentation":"This GameFrameworkException is thrown by ResourceManager.ApplyResources when m_ResourceUpdater is null — i.e. the resource system is in a valid updatable mode but the updater component has not been created/initialized yet. The apply operation needs the updater, so the call is rejected until it exists. It is a readiness-state guard.","triggerScenarios":"Calling ApplyResources before the resource update pipeline has been started (updater not yet instantiated); calling it during an early lifecycle stage where only the helper chain was initialized; applying a resource pack before UpdateVersion/UpdateResources flow set up the updater.","commonSituations":"Calling ApplyResources immediately after initialization instead of after the update flow has begun; race where UI code triggers pack application before the updater exists; custom integrations that skip the standard update startup.","solutions":["Delay ApplyResources until the resource updater is ready (typically after the update pipeline has started, e.g. after UpdateVersion/version-check flow).","Follow the standard GameFramework update flow order: set mode, check versions, then use updater-dependent APIs.","If the flow allows it, ensure the updater helper is created and registered before applying packs."],"exampleFix":"// before\nresourceManager.Initialize(ResourceMode.Updatable, ...);\nresourceManager.ApplyResources(packPath, callback); // updater not created yet\n// after\nresourceManager.Initialize(ResourceMode.Updatable, ...);\n// start update flow first, then once the updater exists:\nresourceManager.ApplyResources(packPath, callback);","handlingStrategy":"try-catch","validationCode":"// only call after the update flow has started\nStartUpdateFlow(onReady: () => resourceManager.ApplyResources(packPath, callback));","typeGuard":null,"tryCatchPattern":"try { resourceManager.ApplyResources(packPath, callback); }\ncatch (GameFrameworkException ex) when (ex.Message.Contains(\"at this time\")) { UnityEngine.Debug.LogError(\"Resource updater not ready; retry after update flow starts.\"); }","preventionTips":["Follow the standard flow: init -> version check -> updater-dependent APIs.","Never call updater-dependent APIs synchronously right after Initialize.","Sequence UI-driven calls after the update pipeline reports ready."],"tags":["csharp","gameframework","not-initialized","lifecycle"],"backgroundTag":"missing-dependency","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"}