{"record":{"id":"41e090b3e6e037d1","repo":"EllanJiang/GameFramework","slug":"resource-pack-path-is-invalid","errorCode":null,"errorMessage":"Resource pack path is invalid.","messagePattern":"Resource pack path is invalid\\.","errorType":"validation","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/ResourceManager.cs","lineNumber":1251,"sourceCode":"            {\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            }\n\n            if (!File.Exists(resourcePackPath))\n            {\n                throw new GameFrameworkException(Utility.Text.Format(\"Resource pack '{0}' is not exist.\", resourcePackPath));\n            }\n\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)","sourceCodeStart":1233,"sourceCodeEnd":1269,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.cs#L1233-L1269","documentation":"Thrown by ResourceManager.ApplyResources when the resourcePackPath argument is null or an empty string. ApplyResources needs a concrete filesystem path to the resource pack to apply, so an empty path is rejected before any file access.","triggerScenarios":"Calling ApplyResources(string, ApplyResourcesCompleteCallback) with null or \"\", e.g. from config that failed to supply the pack path or a variable that was never set after a download step.","commonSituations":"Resource pack download step failed silently leaving path empty; config field missing; path built from a formatting bug producing an empty string.","solutions":["Validate and set the resource pack path before calling ApplyResources.","Ensure the download/step that produces the pack path succeeded first.","Catch GameFrameworkException and surface the misconfiguration."],"exampleFix":"// before\nm_ResourceManager.ApplyResources(packPath, OnApplyComplete); // packPath == \"\"\n// after\nif (!string.IsNullOrEmpty(packPath)) {\n    m_ResourceManager.ApplyResources(packPath, OnApplyComplete);\n}","handlingStrategy":"validation","validationCode":"if (!m_ResourceInitCompleted) {\n    Log.Error(\"CheckResources called before initialization completed\");\n    return;\n}\nm_ResourceManager.CheckResources(ignoreOtherVariant, cb);","typeGuard":null,"tryCatchPattern":"try { m_ResourceManager.CheckResources(ignore, cb); } catch (GameFrameworkException ex) { RestartResourceInitialization(); }","preventionTips":["Run the update flow only after the full initialization state machine completes.","Handle init failures by restarting initialization instead of proceeding.","Track init state explicitly and assert before update steps."],"tags":["unity","gameframework","argument-validation","path"],"backgroundTag":"empty-required-field","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"}