EllanJiang/GameFramework · error · GameFrameworkException
Can not load scene ' '.
Error message
Can not load scene '{0}'. What it means
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.
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.
Example fix
// before
resourceComponent.LoadScene("Main");
// after
resourceComponent.LoadScene("Assets/Scenes/Main.unity",
new LoadSceneCallbacks(onLoaded, onFailure: (n, status, msg, ud) => Log.Error($"Scene {n}: {msg}"))); Defensive patterns
Strategy: try-catch
Validate before calling
// Confirm exact scene asset name exists
string sceneName = "Assets/Scenes/Main.unity";
if (!resourceComponent.HasAsset(sceneName)) { Log.Warning("Scene not in catalog"); return; } Try / catch
try { resourceComponent.LoadScene(sceneName, new LoadSceneCallbacks(onLoaded,
(n, s, m, u) => Log.Error($"LoadScene failed: {n} [{s}] {m}"))); }
catch (GameFrameworkException ex) { Log.Error(ex.Message); } Prevention
- Use full scene asset names ('Assets/...')
- Add scenes to the resource build list
- Complete resource init before LoadScene
- Always pass failure callbacks
When it happens
Trigger: 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.
Common situations: Scene not added to build settings / resource build list, typo'd scene name, loading before resource initialization, or scenes excluded from the resource package.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Can not load dependency asset
- Can not load scene asset
- Can not find asset of scene
- Can not load asset ' '.
- Can not load asset ' ' which is a binary asset.
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/fe9802a0ee670d18.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/Resource/ResourceManager.ResourceLoader.cs:386
/// </summary>
/// <param name="sceneAssetName">要加载场景资源的名称。</param>
/// <param name="priority">加载场景资源的优先级。</param>
/// <param name="loadSceneCallbacks">加载场景回调函数集。</param>
/// <param name="userData">用户自定义数据。</param>
public void LoadScene(string sceneAssetName, int priority, LoadSceneCallbacks loadSceneCallbacks, object userData)
{
ResourceInfo resourceInfo = null;
string[] dependencyAssetNames = null;
if (!CheckAsset(sceneAssetName, out resourceInfo, out dependencyAssetNames))
{
string errorMessage = Utility.Text.Format("Can not load scene '{0}'.", sceneAssetName);
if (loadSceneCallbacks.LoadSceneFailureCallback != null)
{
loadSceneCallbacks.LoadSceneFailureCallback(sceneAssetName, resourceInfo != null && !resourceInfo.Ready ? LoadResourceStatus.NotReady : LoadResourceStatus.NotExist, errorMessage, userData);
return;
}
throw new GameFrameworkException(errorMessage);
}
if (resourceInfo.IsLoadFromBinary)
{
string errorMessage = Utility.Text.Format("Can not load scene asset '{0}' which is a binary asset.", sceneAssetName);
if (loadSceneCallbacks.LoadSceneFailureCallback != null)
{
loadSceneCallbacks.LoadSceneFailureCallback(sceneAssetName, LoadResourceStatus.TypeError, errorMessage, userData);
return;
}
throw new GameFrameworkException(errorMessage);
}
LoadSceneTask mainTask = LoadSceneTask.Create(sceneAssetName, priority, resourceInfo, dependencyAssetNames, loadSceneCallbacks, userData);
foreach (string dependencyAssetName in dependencyAssetNames)
{
if (!LoadDependencyAsset(dependencyAssetName, priority, mainTask, userData))View on GitHub (pinned to d0c010b051)