# SearchAndRemapMaterials(string)

> Search the project for matching materials and use them instead of the internal materials.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.0/script-reference/unityeditor.md)
* **Assembly:** UnityEditor

```csharp
public bool SearchAndRemapMaterials(string materialFolderPath)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The path to search for matching materials.

### Returns

| Type                                                          | Description                                                        |
| ------------------------------------------------------------- | ------------------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Returns true if any materials have been remapped, otherwise false. |

### Remarks

Unity follows specific naming conventions when importing SpeedTree materials. This allows Unity to search for matching material assets by name.

The **materialFolderPath** is relative to the project folder, for example "Assets/MyModel Materials".

Throws **ArgumentNullException** when the path is *null* and **ArgumentException** when the file path is *empty*.

### Examples

```csharp
using UnityEditor;

public class MaterialRemapper : AssetPostprocessor
{
    void OnPreprocessModel()
    {
        var importer = assetImporter as SpeedTreeImporter;
        importer.SearchAndRemapMaterials(importer.materialFolderPath);
    }
}
```
