{"record":{"id":"13692a7139f3fa4c","repo":"EllanJiang/GameFramework","slug":"unload-scene-failure-scene-asset-name-0","errorCode":null,"errorMessage":"Unload scene failure, scene asset name '{0}'.","messagePattern":"Unload scene failure, scene asset name '(.+?)'\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Scene/SceneManager.cs","lineNumber":505,"sourceCode":"            {\n                UnloadSceneSuccessEventArgs unloadSceneSuccessEventArgs = UnloadSceneSuccessEventArgs.Create(sceneAssetName, userData);\n                m_UnloadSceneSuccessEventHandler(this, unloadSceneSuccessEventArgs);\n                ReferencePool.Release(unloadSceneSuccessEventArgs);\n            }\n        }\n\n        private void UnloadSceneFailureCallback(string sceneAssetName, object userData)\n        {\n            m_UnloadingSceneAssetNames.Remove(sceneAssetName);\n            if (m_UnloadSceneFailureEventHandler != null)\n            {\n                UnloadSceneFailureEventArgs unloadSceneFailureEventArgs = UnloadSceneFailureEventArgs.Create(sceneAssetName, userData);\n                m_UnloadSceneFailureEventHandler(this, unloadSceneFailureEventArgs);\n                ReferencePool.Release(unloadSceneFailureEventArgs);\n                return;\n            }\n\n            throw new GameFrameworkException(Utility.Text.Format(\"Unload scene failure, scene asset name '{0}'.\", sceneAssetName));\n        }\n    }\n}\n","sourceCodeStart":487,"sourceCodeEnd":509,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Scene/SceneManager.cs#L487-L509","documentation":"UnloadSceneFailureCallback fires when the resource layer reports a scene unload failure. If no UnloadSceneFailure event handler is registered, the framework throws this GameFrameworkException naming the scene that could not be unloaded.","triggerScenarios":"An asynchronous scene unload fails at the resource layer while m_UnloadSceneFailureEventHandler is null (UnloadSceneFailure never subscribed).","commonSituations":"Resource subsystem errors during unload (destroyed scene, invalid resource state); forgetting to subscribe to UnloadSceneFailure; unload failures after forceful scene teardown or editor play-mode interruptions.","solutions":["Subscribe to SceneManager.UnloadSceneFailure so failures arrive as events rather than exceptions.","Inspect the resource manager's diagnostics for the root cause of the failed unload.","Verify the scene was still valid/loaded at the time the unload was dispatched to the resource layer.","Re-check state (SceneIsLoaded/SceneIsUnloading) and retry the unload if transient."],"exampleFix":"// before\nm_SceneManager.UnloadScene(sceneName);\n// after\nm_SceneManager.UnloadSceneFailure += (sender, e) => Log.Error(\"Unload scene failed: {0}\", e.SceneAssetName);\nm_SceneManager.UnloadScene(sceneName);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { sceneManager.UnloadScene(sceneAssetName); }\ncatch (GameFrameworkException ex) { Log.Error(\"Scene unload failed: {0}\", ex.Message); }","preventionTips":["Subscribe UnloadSceneFailure before any UnloadScene call","Log and inspect resource-layer errors promptly","Retry unloads only after confirming state with SceneIsLoaded"],"tags":["gameframework","scene-management","unload-failure","event-handler"],"backgroundTag":"api-request-failed","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"}