Documentation

Unity Engine

Unity Engine

SetShader

Sets the shader of the materials that the editor is inspecting, and registers an undo operation.
Read time 1 minuteLast updated 20 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule

SetShader(Shader)

Sets the shader of the materials that the editor is inspecting, and registers an undo operation.
public void SetShader(Shader shader)

Parameters

shader

The shader to assign to the materials.

Remarks

The method also rebuilds the inspector for the new shader. To change the shader without undo support, use the overload that takes
registerUndo
.

SetShader(Shader, bool)

Sets the shader of the materials that the editor is inspecting, with the option to register an undo operation.
public void SetShader(Shader newShader, bool registerUndo)

Parameters

newShader

The shader to assign to the materials.

registerUndo

Set to true to register an undo operation for the change. Set to false to change the shader without undo support.

Remarks

The method also rebuilds the inspector for the new shader.