{"record":{"id":"f4c3e41cc9bba40e","repo":"Unity-Technologies/UnityCsReference","slug":"host-type-is-not-matching-any-asset-type-at-path","errorCode":null,"errorMessage":"Host type is not matching any asset type at Path {path}.","messagePattern":"Host type is not matching any asset type at Path (.+?)\\.","errorType":"exception","errorClass":"InvalidImportException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/RenderPipelineResourcesEditorUtils.cs","lineNumber":238,"sourceCode":"                    SearchType.ProjectPath => AssetDatabase.LoadAssetAtPath(path, type), //return null if path is wrong\n                    SearchType.ShaderName => throw new ArgumentException($\"{nameof(SearchType.ShaderName)} is only available for Shaders.\"),\n                    _ => throw new NotImplementedException($\"Unknown {location}\")\n                };\n\n            void CheckTypeMismatch(string path, Type expectedType)\n            {\n                UnityEngine.Object[] assets = AssetDatabase.LoadAllAssetsAtPath(path);\n                if (assets == null)\n                    return;\n                bool foundCandidate = false;\n                foreach (var asset in assets)\n                    if (expectedType.IsAssignableFrom(asset.GetType()))\n                    {\n                        foundCandidate = true;\n                        break;\n                    }\n                if (!foundCandidate)\n                    throw new InvalidImportException($\"Host type is not matching any asset type at Path {path}.\");\n            }\n        }\n    }\n}\n","sourceCodeStart":220,"sourceCodeEnd":243,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/RenderPipelineResourcesEditorUtils.cs#L220-L243","documentation":"RenderPipelineResourcesEditorUtils.CheckTypeMismatch throws InvalidImportException when the host type expected by a render pipeline resource does not match any asset type found at the given path. This is a type-compatibility check that loads all assets at a path and verifies at least one is assignable to the expected type.","triggerScenarios":"Loading assets at a path where AssetDatabase.LoadAllAssetsAtPath returns assets, but none of them are assignable to the expected type (expectedType.IsAssignableFrom(asset.GetType()) fails for all assets at that path).","commonSituations":"A render pipeline resource slot expects a specific type (e.g., a ComputeShader or Texture2DArray) but the asset at that path is a different type (e.g., a regular Texture2D or Material). Common when assets are replaced with incompatible types, or when a path was reassigned to point at a different asset type after a pipeline upgrade. Also occurs with importer settings that change the output type.","solutions":["Verify the asset at the path is of the expected type using AssetDatabase.LoadAssetAtPath(path, expectedType).","Check the asset's import settings (e.g., texture import type, model import settings) to ensure the output type matches.","If the asset was replaced, re-assign the correct asset in the render pipeline resource inspector (Project Settings > Graphics or the URP/HDRP asset).","Re-import the asset to ensure its type matches expectations.","Check for type hierarchies: a base type reference may need a derived type asset (e.g., expecting Texture but only a Material is present)."],"exampleFix":"// before\n// path points to a Material but expectedType is Texture\nvar asset = resource.Load(\"Assets/Materials/MyMaterial.mat\", typeof(Texture), SearchType.ProjectPath);\n// after\nvar found = AssetDatabase.LoadAssetAtPath<Texture>(\"Assets/Materials/MyMaterial.mat\");\nif (found != null)\n    var asset = resource.Load(\"Assets/Materials/MyMaterial.mat\", typeof(Texture), SearchType.ProjectPath);\nelse\n{\n    var texPath = \"Assets/Textures/MyTexture.asset\";\n    var asset = resource.Load(texPath, typeof(Texture), SearchType.ProjectPath);\n}","handlingStrategy":"validation","validationCode":"var testAsset = AssetDatabase.LoadAssetAtPath(path, expectedType);\nif (testAsset != null)\n    var asset = resource.Load(path, expectedType, SearchType.ProjectPath);\nelse\n    Debug.LogError($\"Asset at {path} is not of expected type {expectedType.Name}\");","typeGuard":"static bool AssetMatchesType(string path, Type expected)\n    => AssetDatabase.LoadAssetAtPath(path, expected) != null;","tryCatchPattern":"try\n{\n    var asset = resource.Load(path, type, SearchType.ProjectPath);\n}\ncatch (InvalidImportException ex) when (ex.Message.Contains(\"Host type\"))\n{\n    Debug.LogError($\"Type mismatch at {path}. Expected {type.Name}. Check asset import settings.\");\n}","preventionTips":["Verify asset types match render pipeline resource slot expectations","Check import settings after re-importing or replacing assets","Re-assign correct asset types in the render pipeline resource inspector","Validate type compatibility programmatically with AssetDatabase.LoadAssetAtPath before loading"],"tags":["unity","render-pipeline","type-mismatch","srp","invalid-import"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}