Unity-Technologies/UnityCsReference · error · ArgumentException
Couldn't locate scene asset at path {scenePath}
Error message
Couldn't locate scene asset at path {scenePath} What it means
Thrown by CreateLoadableSceneId after the path passes the .unity check but AssetDatabase.AssetPathToGUID returns an empty GUID — meaning Unity has no registered asset at that path. The scene asset cannot be located, so a handle cannot be built.
Source
Thrown at Editor/Mono/Loadable/LoadableSceneIdEditorUtility.cs:73
/// Create a LoadableSceneId object based on a scene's path.
/// </summary>
/// <param name="scenePath">The scene's path within the project. Must end with .unity extension.</param>
/// <returns>A LoadableSceneId handle populated to reference the provided scene.</returns>
/// <exception cref="System.ArgumentNullException">
/// Thrown if scenePath is null or empty.
/// </exception>
/// <exception cref="System.ArgumentException">
/// Thrown if the path doesn't end with .unity extension or if the scene asset cannot be found at the specified path.
/// </exception>
public static LoadableSceneId CreateLoadableSceneId(string scenePath)
{
if (string.IsNullOrEmpty(scenePath))
throw new ArgumentNullException(nameof(scenePath), "Scene path cannot be null or empty.");
if (!scenePath.EndsWith(".unity", StringComparison.CurrentCultureIgnoreCase))
throw new ArgumentException($"Path {scenePath} is not a scene path. Must end with .unity extension.");
var guid = new GUID(AssetDatabase.AssetPathToGUID(scenePath));
if (guid.Empty())
throw new ArgumentException($"Couldn't locate scene asset at path {scenePath}");
return CreateLoadableSceneId(guid);
}
}
}
View on GitHub (pinned to 225b0fbdb5)
Solutions
- Resolve the path from a live SceneAsset reference (AssetDatabase.GetAssetPath) instead of a stored string.
- Verify AssetDatabase.AssetPathToGUID(scenePath) is non-empty before calling, and log which path failed.
- Re-import the scene and refresh the AssetDatabase (AssetDatabase.Refresh) if the file exists but is untracked.
Example fix
// before
var id = LoadableSceneIdEditorUtility.CreateLoadableSceneId(scenePath);
// after
if (string.IsNullOrEmpty(AssetDatabase.AssetPathToGUID(scenePath)))
throw new InvalidOperationException($"Scene not found in AssetDatabase: {scenePath}");
var id = LoadableSceneIdEditorUtility.CreateLoadableSceneId(scenePath); Defensive patterns
Strategy: validation
Validate before calling
if (string.IsNullOrEmpty(AssetDatabase.AssetPathToGUID(scenePath))) throw new InvalidOperationException($"Scene not tracked: {scenePath}"); Try / catch
try { CreateLoadableSceneId(scenePath); }
catch (ArgumentException ex) when (ex.Message.Contains("locate scene asset")) { AssetDatabase.Refresh(); CreateLoadableSceneId(scenePath); } Prevention
- Resolve paths from live SceneAsset references
- Refresh AssetDatabase when files exist but are untracked
- Validate GUID is non-empty before use
When it happens
Trigger: Passing a path that looks like a scene path but does not correspond to any imported asset: wrong folder, moved/deleted scene, a path from a different project, or a scene not yet imported into the AssetDatabase.
Common situations: Hard-coded or serialized scene paths that go stale after a scene is moved or renamed. Build scripts reading scene paths from a config that was not kept in sync. Paths with incorrect casing on case-sensitive filesystems.
Related errors
- Preview scene could not be created
- Meta file not found: {metaFilePath}
- Scene path cannot be null or empty.
- Path {scenePath} is not a scene path. Must end with .unity e
- Prefab not found at path {prefabAssetPath}
AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13).
Data as JSON: /api/errors/c07216840249eba0.
Report an issue: GitHub.