# AssignNewShaderToMaterial(Material, Shader, Shader)

> This method is called when a new shader has been selected for a Material.

## Definition

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

```csharp
public virtual void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader)
```

### Parameters

**** (\[Material]\(/engine/6000.5/script-reference/unityengine/material)): The material the newShader should be assigned to.**** (\[Shader]\(/engine/6000.5/script-reference/unityengine/shader)): Previous shader.**** (\[Shader]\(/engine/6000.5/script-reference/unityengine/shader)): New shader to assign to the material.

### Remarks

Can be used for setting up the new shader based on state from the previous shader. Ensure to call *base.AssignNewShaderToMaterial* to actually set *material.shader*.
