{"record":{"id":"c07216840249eba0","repo":"Unity-Technologies/UnityCsReference","slug":"couldn-t-locate-scene-asset-at-path-scenepath","errorCode":null,"errorMessage":"Couldn't locate scene asset at path {scenePath}","messagePattern":"Couldn't locate scene asset at path (.+?)","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/Loadable/LoadableSceneIdEditorUtility.cs","lineNumber":73,"sourceCode":"        /// Create a LoadableSceneId object based on a scene's path.\n        /// </summary>\n        /// <param name=\"scenePath\">The scene's path within the project. Must end with .unity extension.</param>\n        /// <returns>A LoadableSceneId handle populated to reference the provided scene.</returns>\n        /// <exception cref=\"System.ArgumentNullException\">\n        /// Thrown if scenePath is null or empty.\n        /// </exception>\n        /// <exception cref=\"System.ArgumentException\">\n        /// Thrown if the path doesn't end with .unity extension or if the scene asset cannot be found at the specified path.\n        /// </exception>\n        public static LoadableSceneId CreateLoadableSceneId(string scenePath)\n        {\n            if (string.IsNullOrEmpty(scenePath))\n                throw new ArgumentNullException(nameof(scenePath), \"Scene path cannot be null or empty.\");\n            if (!scenePath.EndsWith(\".unity\", StringComparison.CurrentCultureIgnoreCase))\n                throw new ArgumentException($\"Path {scenePath} is not a scene path. Must end with .unity extension.\");\n            var guid = new GUID(AssetDatabase.AssetPathToGUID(scenePath));\n            if (guid.Empty())\n                throw new ArgumentException($\"Couldn't locate scene asset at path {scenePath}\");\n            return CreateLoadableSceneId(guid);\n        }\n    }\n}\n","sourceCodeStart":55,"sourceCodeEnd":78,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/Loadable/LoadableSceneIdEditorUtility.cs#L55-L78","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nvar id = LoadableSceneIdEditorUtility.CreateLoadableSceneId(scenePath);\n\n// after\nif (string.IsNullOrEmpty(AssetDatabase.AssetPathToGUID(scenePath)))\n    throw new InvalidOperationException($\"Scene not found in AssetDatabase: {scenePath}\");\nvar id = LoadableSceneIdEditorUtility.CreateLoadableSceneId(scenePath);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(AssetDatabase.AssetPathToGUID(scenePath))) throw new InvalidOperationException($\"Scene not tracked: {scenePath}\");","typeGuard":null,"tryCatchPattern":"try { CreateLoadableSceneId(scenePath); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"locate scene asset\")) { AssetDatabase.Refresh(); CreateLoadableSceneId(scenePath); }","preventionTips":["Resolve paths from live SceneAsset references","Refresh AssetDatabase when files exist but are untracked","Validate GUID is non-empty before use"],"tags":["unity","editor","scene","asset-database","guid"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}