# CopyMatchingPropertiesFromMaterial(Material)

> Copies properties, keyword states and settings from mat to this material, but only if they exist in both materials.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.6/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
public void CopyMatchingPropertiesFromMaterial(Material mat)
```

### Parameters

**** (\[Material]\(/engine/6000.6/script-reference/unityengine/material)): The [Material](/engine/6000.6/script-reference/unityengine/material.md) to copy from.

### Remarks

This method copies the following properties if they exist in both materials:

* Serialized material properties.
* Keyword states, if the keywords exist in both shaders.
* Material settings: [Material.doubleSidedGI](/engine/6000.6/script-reference/unityengine/material/doublesidedgi.md), [Material.enableInstancing](/engine/6000.6/script-reference/unityengine/material/enableinstancing.md), [Material.renderQueue](/engine/6000.6/script-reference/unityengine/material/renderqueue.md) and [Material.globalIlluminationFlags](/engine/6000.6/script-reference/unityengine/material/globalilluminationflags.md).

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{
    // Attach this script to a GameObject that has a renderer.
    // Copies any property from mat and assigns it to this transform's material, if the property exists in both materials.

    Material mat;

    void Start()
    {
        GetComponent<Renderer>().material.CopyMatchingPropertiesFromMaterial(mat);
    }
}
```
