Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

MaterialEditor.SetShader

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public void SetShader(Shader shader);

Parameters

Parameter Description
shader The shader to assign to the materials.

Description

Sets the shader of the materials that the editor is inspecting, and registers an undo operation.

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


Declaration

public void SetShader(Shader newShader, bool registerUndo);

Parameters

Parameter Description
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.

Description

Sets the shader of the materials that the editor is inspecting, with the option to register an undo operation.

The method also rebuilds the inspector for the new shader.