{"record":{"id":"464e02c3b08bd602","repo":"Unity-Technologies/UnityCsReference","slug":"failed-to-find-path-in-location","errorCode":null,"errorMessage":"Failed to find {path} in {location}.","messagePattern":"Failed to find (.+?) in (.+?)\\.","errorType":"exception","errorClass":"InvalidImportException","httpStatus":null,"severity":"critical","filePath":"Editor/Mono/RenderPipelineResourcesEditorUtils.cs","lineNumber":180,"sourceCode":"            bool SetAndLoadIfNull(Array array, int index, string path, SearchType location)\n            {\n                var element = array.GetValue(index);\n                if (IsNull(element))\n                {\n                    array.SetValue(Load(path, array.GetType().GetElementType(), location), index);\n                    return true;\n                }\n\n                return false;\n            }\n\n            UnityEngine.Object Load(string path, Type type, SearchType location)\n            {\n                // Check if asset exist.\n                // Direct loading can be prevented by AssetDatabase being reloading.\n                var guid = AssetDatabase.AssetPathToGUID(path);\n                if (location == SearchType.ProjectPath && String.IsNullOrEmpty(guid))\n                    throw new InvalidImportException($\"Failed to find {path} in {location}.\");\n\n                UnityEngine.Object result = type == typeof(Shader)\n                    ? LoadShader(path, location)\n                    : LoadNonShaderAssets(path, type, location);\n                \n                if (IsNull(result))\n                    switch (location)\n                    {\n                        case SearchType.ProjectPath:\n                            CheckTypeMismatch(path, type);\n                            throw new InvalidImportException($\"Cannot load. Path {path} is correct but AssetDatabase cannot load now.\");\n                        case SearchType.ShaderName: throw new InvalidImportException($\"Failed to find {path} in {location}.\");\n                        case SearchType.BuiltinPath: throw new InvalidImportException($\"Failed to find {path} in {location}.\");\n                        case SearchType.BuiltinExtraPath: throw new InvalidImportException($\"Failed to find {path} in {location}.\");\n                    }\n                    \n                return result;\n            }","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/RenderPipelineResourcesEditorUtils.cs#L162-L198","documentation":"RenderPipelineResourcesEditorUtils.Load throws InvalidImportException when a ProjectPath asset cannot be resolved to a GUID, meaning the asset does not exist at the given project path. This occurs during render pipeline resource loading when a required shader or asset is missing from the project.","triggerScenarios":"Loading a render pipeline resource at a ProjectPath where AssetDatabase.AssetPathToGUID(path) returns an empty string, indicating no asset exists at that path.","commonSituations":"Render pipeline resources (SRP, URP, HDRP) reference shader/material paths that don't exist because the package isn't installed, the asset was deleted, or a version upgrade changed asset locations. Common after upgrading Unity or switching render pipelines.","solutions":["Verify the asset exists at the given path using AssetDatabase.LoadAssetAtPath or AssetDatabase.AssetPathToGUID.","Ensure the correct render pipeline package (URP/HDRP) is installed via Package Manager.","If upgrading, re-import render pipeline resources or reset them via Edit > Project Settings > Graphics.","Check that the path uses forward slashes and is relative to the project (e.g., 'Packages/com.unity.render-pipelines.universal/...')."],"exampleFix":"// before\nvar shader = resource.Load(\"Packages/com.unity.render-pipelines.universal/Shaders/Lit.shader\", typeof(Shader), SearchType.ProjectPath);\n// after\nvar guid = AssetDatabase.AssetPathToGUID(path);\nif (!string.IsNullOrEmpty(guid))\n    var shader = resource.Load(path, typeof(Shader), SearchType.ProjectPath);\nelse\n    Debug.LogError($\"Render pipeline asset missing at: {path}. Reinstall the package.\");","handlingStrategy":"validation","validationCode":"var guid = AssetDatabase.AssetPathToGUID(path);\nif (!string.IsNullOrEmpty(guid))\n    var asset = resource.Load(path, type, SearchType.ProjectPath);\nelse\n    Debug.LogError($\"Asset not found at project path: {path}\");","typeGuard":"static bool ProjectAssetExists(string path) => !string.IsNullOrEmpty(AssetDatabase.AssetPathToGUID(path));","tryCatchPattern":"try\n{\n    var asset = resource.Load(path, type, SearchType.ProjectPath);\n}\ncatch (InvalidImportException ex)\n{\n    Debug.LogError($\"Render pipeline asset missing: {path}. Reinstall URP/HDRP package.\");\n}","preventionTips":["Ensure URP/HDRP/SRP packages are installed and match the Unity version","Validate asset paths exist before render pipeline resource loading","Re-import render pipeline resources after major upgrades","Use AssetDatabase.AssetPathToGUID to verify paths programmatically"],"tags":["unity","render-pipeline","srp","asset-missing","invalid-import"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}