{"record":{"id":"7d617034da98ec37","repo":"EllanJiang/GameFramework","slug":"scene-asset-0-is-not-loaded-yet","errorCode":null,"errorMessage":"Scene asset '{0}' is not loaded yet.","messagePattern":"Scene asset '(.+?)' is not loaded yet\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Scene/SceneManager.cs","lineNumber":428,"sourceCode":"\n            if (m_ResourceManager == null)\n            {\n                throw new GameFrameworkException(\"You must set resource manager first.\");\n            }\n\n            if (SceneIsUnloading(sceneAssetName))\n            {\n                throw new GameFrameworkException(Utility.Text.Format(\"Scene asset '{0}' is being unloaded.\", sceneAssetName));\n            }\n\n            if (SceneIsLoading(sceneAssetName))\n            {\n                throw new GameFrameworkException(Utility.Text.Format(\"Scene asset '{0}' is being loaded.\", sceneAssetName));\n            }\n\n            if (!SceneIsLoaded(sceneAssetName))\n            {\n                throw new GameFrameworkException(Utility.Text.Format(\"Scene asset '{0}' is not loaded yet.\", sceneAssetName));\n            }\n\n            m_UnloadingSceneAssetNames.Add(sceneAssetName);\n            m_ResourceManager.UnloadScene(sceneAssetName, m_UnloadSceneCallbacks, userData);\n        }\n\n        private void LoadSceneSuccessCallback(string sceneAssetName, float duration, object userData)\n        {\n            m_LoadingSceneAssetNames.Remove(sceneAssetName);\n            m_LoadedSceneAssetNames.Add(sceneAssetName);\n            if (m_LoadSceneSuccessEventHandler != null)\n            {\n                LoadSceneSuccessEventArgs loadSceneSuccessEventArgs = LoadSceneSuccessEventArgs.Create(sceneAssetName, duration, userData);\n                m_LoadSceneSuccessEventHandler(this, loadSceneSuccessEventArgs);\n                ReferencePool.Release(loadSceneSuccessEventArgs);\n            }\n        }\n","sourceCodeStart":410,"sourceCodeEnd":446,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Scene/SceneManager.cs#L410-L446","documentation":"UnloadScene verifies the scene is actually in the loaded-scenes set before unloading. If the scene asset name is not currently loaded, the framework throws this GameFrameworkException because there is nothing to unload.","triggerScenarios":"Calling UnloadScene for a scene that was never loaded, was already unloaded, or whose load failed; using a scene asset name that does not exactly match the string passed to LoadScene.","commonSituations":"Unloading a scene that failed to load; double-unloading after an earlier success; typos or path casing/format differences between the loaded name and the unload name; unload firing after scene reset logic already cleared scenes.","solutions":["Check SceneManager.SceneIsLoaded(sceneAssetName) before calling UnloadScene and skip if false.","Verify the asset name exactly matches the one used in the successful LoadScene call.","Track your own loaded/unloaded state or subscribe to UnloadSceneSuccess before issuing another unload.","If the scene needs replacing, confirm the prior load succeeded via LoadSceneSuccess before unloading anything."],"exampleFix":"// before\nm_SceneManager.UnloadScene(sceneName);\n// after\nif (m_SceneManager.SceneIsLoaded(sceneName))\n{\n    m_SceneManager.UnloadScene(sceneName);\n}","handlingStrategy":"validation","validationCode":"if (sceneManager.SceneIsLoaded(sceneAssetName))\n{\n    sceneManager.UnloadScene(sceneAssetName);\n}","typeGuard":null,"tryCatchPattern":"try { sceneManager.UnloadScene(sceneAssetName); }\ncatch (GameFrameworkException) { /* scene not loaded; nothing to do */ }","preventionTips":["Use the exact same asset-name string for load and unload","Track loaded scenes locally or rely on SceneIsLoaded checks","Clean up unload bookkeeping on UnloadSceneSuccess"],"tags":["gameframework","scene-management","resource-not-found","invalid-state-transition"],"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"}