{"record":{"id":"fe9802a0ee670d18","repo":"EllanJiang/GameFramework","slug":"can-not-load-scene-0","errorCode":null,"errorMessage":"Can not load scene '{0}'.","messagePattern":"Can not load scene '(.+?)'\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/ResourceManager.ResourceLoader.cs","lineNumber":386,"sourceCode":"            /// </summary>\n            /// <param name=\"sceneAssetName\">要加载场景资源的名称。</param>\n            /// <param name=\"priority\">加载场景资源的优先级。</param>\n            /// <param name=\"loadSceneCallbacks\">加载场景回调函数集。</param>\n            /// <param name=\"userData\">用户自定义数据。</param>\n            public void LoadScene(string sceneAssetName, int priority, LoadSceneCallbacks loadSceneCallbacks, object userData)\n            {\n                ResourceInfo resourceInfo = null;\n                string[] dependencyAssetNames = null;\n                if (!CheckAsset(sceneAssetName, out resourceInfo, out dependencyAssetNames))\n                {\n                    string errorMessage = Utility.Text.Format(\"Can not load scene '{0}'.\", sceneAssetName);\n                    if (loadSceneCallbacks.LoadSceneFailureCallback != null)\n                    {\n                        loadSceneCallbacks.LoadSceneFailureCallback(sceneAssetName, resourceInfo != null && !resourceInfo.Ready ? LoadResourceStatus.NotReady : LoadResourceStatus.NotExist, errorMessage, userData);\n                        return;\n                    }\n\n                    throw new GameFrameworkException(errorMessage);\n                }\n\n                if (resourceInfo.IsLoadFromBinary)\n                {\n                    string errorMessage = Utility.Text.Format(\"Can not load scene asset '{0}' which is a binary asset.\", sceneAssetName);\n                    if (loadSceneCallbacks.LoadSceneFailureCallback != null)\n                    {\n                        loadSceneCallbacks.LoadSceneFailureCallback(sceneAssetName, LoadResourceStatus.TypeError, errorMessage, userData);\n                        return;\n                    }\n\n                    throw new GameFrameworkException(errorMessage);\n                }\n\n                LoadSceneTask mainTask = LoadSceneTask.Create(sceneAssetName, priority, resourceInfo, dependencyAssetNames, loadSceneCallbacks, userData);\n                foreach (string dependencyAssetName in dependencyAssetNames)\n                {\n                    if (!LoadDependencyAsset(dependencyAssetName, priority, mainTask, userData))","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.ResourceLoader.cs#L368-L404","documentation":"LoadScene could not resolve or load the requested scene and no failure callback was supplied, so the error message is thrown. Fired when the scene has no resource info, the resource is not ready, or the info lookup failed.","triggerScenarios":"Calling LoadScene with a scene asset name absent from resource info, whose resource is not ready, or with resourceInfo failing checks while LoadSceneFailureCallback is null.","commonSituations":"Scene not added to build settings / resource build list, typo'd scene name, loading before resource initialization, or scenes excluded from the resource package.","solutions":["Verify the scene name matches the built scene asset name (e.g. 'Assets/Scenes/Main.unity').","Include the scene in the resource build configuration.","Ensure resource initialization/update completed before LoadScene.","Pass LoadSceneCallbacks with a failure callback to avoid the throw."],"exampleFix":"// before\nresourceComponent.LoadScene(\"Main\");\n// after\nresourceComponent.LoadScene(\"Assets/Scenes/Main.unity\",\n    new LoadSceneCallbacks(onLoaded, onFailure: (n, status, msg, ud) => Log.Error($\"Scene {n}: {msg}\")));","handlingStrategy":"try-catch","validationCode":"// Confirm exact scene asset name exists\nstring sceneName = \"Assets/Scenes/Main.unity\";\nif (!resourceComponent.HasAsset(sceneName)) { Log.Warning(\"Scene not in catalog\"); return; }","typeGuard":null,"tryCatchPattern":"try { resourceComponent.LoadScene(sceneName, new LoadSceneCallbacks(onLoaded,\n    (n, s, m, u) => Log.Error($\"LoadScene failed: {n} [{s}] {m}\"))); }\ncatch (GameFrameworkException ex) { Log.Error(ex.Message); }","preventionTips":["Use full scene asset names ('Assets/...')","Add scenes to the resource build list","Complete resource init before LoadScene","Always pass failure callbacks"],"tags":["gameframework","resource-management","scene-loading","missing-scene"],"backgroundTag":"resource-not-found","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"}