EllanJiang/GameFramework · error · GameFrameworkException
Scene asset ' ' is being loaded.
Error message
Scene asset '{0}' is being loaded. What it means
LoadScene throws this formatted error when the requested scene is already being loaded (SceneIsLoading returns true). Starting a second load for the same in-flight scene is rejected to prevent duplicate load operations.
Solutions
- Check SceneIsLoading/SceneIsLoaded before calling LoadScene and skip if already in progress
- Deduplicate at the call site with a flag that clears on LoadSceneComplete
- Only issue scene loads from a single owning procedure or service
Example fix
// before
m_SceneManager.LoadScene(sceneAssetName);
// after
if (m_SceneManager.SceneIsLoading(sceneAssetName) || m_SceneManager.SceneIsLoaded(sceneAssetName))
{
return;
}
m_SceneManager.LoadScene(sceneAssetName); Defensive patterns
Strategy: validation
Validate before calling
if (sceneManager.SceneIsLoading(sceneAssetName) || sceneManager.SceneIsLoaded(sceneAssetName)) return;
Type guard
bool IsSceneLoadable(SceneManager sm, string name) => !sm.SceneIsLoading(name) && !sm.SceneIsLoaded(name);
Try / catch
try { sceneManager.LoadScene(name); } catch (GameFrameworkException ex) when (ex.Message.Contains("being loaded")) { /* already loading; ignore */ } Prevention
- Guard LoadScene calls with SceneIsLoading/SceneIsLoaded checks
- Use a loading-in-progress flag cleared on LoadSceneComplete
- Dispatch scene-load requests from a single owner to avoid duplicates
When it happens
Trigger: Calling LoadScene twice for the same sceneAssetName before the first load completes — e.g. double event dispatch, a retry loop that fires immediately, or two procedures both issuing the load.
Common situations: Player pressing a button twice while a scene loads, re-entrant procedure Update issuing LoadScene every frame, or event handler registered multiple times.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- Results is invalid.
- Scene asset ' ' is being unloaded.
- Scene asset name is invalid.
- You must set resource manager first.
- Access is invalid.
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/ccc604c2cf71db9f.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/Scene/SceneManager.cs:378
{
if (string.IsNullOrEmpty(sceneAssetName))
{
throw new GameFrameworkException("Scene asset name is invalid.");
}
if (m_ResourceManager == null)
{
throw new GameFrameworkException("You must set resource manager first.");
}
if (SceneIsUnloading(sceneAssetName))
{
throw new GameFrameworkException(Utility.Text.Format("Scene asset '{0}' is being unloaded.", sceneAssetName));
}
if (SceneIsLoading(sceneAssetName))
{
throw new GameFrameworkException(Utility.Text.Format("Scene asset '{0}' is being loaded.", sceneAssetName));
}
if (SceneIsLoaded(sceneAssetName))
{
throw new GameFrameworkException(Utility.Text.Format("Scene asset '{0}' is already loaded.", sceneAssetName));
}
m_LoadingSceneAssetNames.Add(sceneAssetName);
m_ResourceManager.LoadScene(sceneAssetName, priority, m_LoadSceneCallbacks, userData);
}
/// <summary>
/// 卸载场景。
/// </summary>
/// <param name="sceneAssetName">场景资源名称。</param>
public void UnloadScene(string sceneAssetName)
{
UnloadScene(sceneAssetName, null);View on GitHub (pinned to d0c010b051)