Documentation

Unity Engine

Unity Engine

ShaderProperty

Draws the UI for a shader property, using automatic layout.
Read time 5 minutesLast updated 20 days ago

Definition

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

ShaderProperty(MaterialProperty, string)

Draws the UI for a shader property, using automatic layout.
public void ShaderProperty(MaterialProperty prop, string label)

Parameters

The material property to draw UI for.

label

The label to show for the property.

Remarks

This method draws the appropriate UI for the type of the shader property. It applies any custom MaterialPropertyDrawer that the shader defines for the property. To draw the default UI without custom drawers, use MaterialEditor.DefaultShaderProperty. This overload uses automatic layout. To set the position and size of the control, use the overload that takes a Rect.

ShaderProperty(MaterialProperty, GUIContent)

Draws the UI for a shader property with a label and tooltip, using automatic layout.
public void ShaderProperty(MaterialProperty prop, GUIContent label)

Parameters

The material property to draw UI for.

The label to show for the property, including any tooltip.

Remarks

This method draws the appropriate UI for the type of the shader property. It applies any custom MaterialPropertyDrawer that the shader defines for the property. To draw the default UI without custom drawers, use MaterialEditor.DefaultShaderProperty. This overload uses automatic layout. To set the position and size of the control, use the overload that takes a Rect.

ShaderProperty(MaterialProperty, string, int)

Draws the UI for a shader property with an indented label, using automatic layout.
public void ShaderProperty(MaterialProperty prop, string label, int labelIndent)

Parameters

The material property to draw UI for.

label

The label to show for the property.

labelIndent

The number of levels to indent the label by.

Remarks

This method draws the appropriate UI for the type of the shader property. It applies any custom MaterialPropertyDrawer that the shader defines for the property. To draw the default UI without custom drawers, use MaterialEditor.DefaultShaderProperty. This overload uses automatic layout. To set the position and size of the control, use the overload that takes a Rect.

ShaderProperty(MaterialProperty, GUIContent, int)

Draws the UI for a shader property with an indented label and tooltip, using automatic layout.
public void ShaderProperty(MaterialProperty prop, GUIContent label, int labelIndent)

Parameters

The material property to draw UI for.

The label to show for the property, including any tooltip.

labelIndent

The number of levels to indent the label by.

Remarks

This method draws the appropriate UI for the type of the shader property. It applies any custom MaterialPropertyDrawer that the shader defines for the property. To draw the default UI without custom drawers, use MaterialEditor.DefaultShaderProperty. This overload uses automatic layout. To set the position and size of the control, use the overload that takes a Rect.

ShaderProperty(Rect, MaterialProperty, string)

Draws the UI for a shader property at a specified position.
public void ShaderProperty(Rect position, MaterialProperty prop, string label)

Parameters

position

The position and size of the control.

The material property to draw UI for.

label

The label to show for the property.

Remarks

This method draws the appropriate UI for the type of the shader property. It applies any custom MaterialPropertyDrawer that the shader defines for the property. To draw the default UI without custom drawers, use MaterialEditor.DefaultShaderProperty. This overload draws the control at
position
. To use automatic layout, use the overload without a Rect.

ShaderProperty(Rect, MaterialProperty, GUIContent)

Draws the UI for a shader property with a label and tooltip, at a specified position.
public void ShaderProperty(Rect position, MaterialProperty prop, GUIContent label)

Parameters

position

The position and size of the control.

The material property to draw UI for.

The label to show for the property, including any tooltip.

Remarks

This method draws the appropriate UI for the type of the shader property. It applies any custom MaterialPropertyDrawer that the shader defines for the property. To draw the default UI without custom drawers, use MaterialEditor.DefaultShaderProperty. This overload draws the control at
position
. To use automatic layout, use the overload without a Rect.

ShaderProperty(Rect, MaterialProperty, string, int)

Draws the UI for a shader property with an indented label, at a specified position.
public void ShaderProperty(Rect position, MaterialProperty prop, string label, int labelIndent)

Parameters

position

The position and size of the control.

The material property to draw UI for.

label

The label to show for the property.

labelIndent

The number of levels to indent the label by.

Remarks

This method draws the appropriate UI for the type of the shader property. It applies any custom MaterialPropertyDrawer that the shader defines for the property. To draw the default UI without custom drawers, use MaterialEditor.DefaultShaderProperty. This overload draws the control at
position
. To use automatic layout, use the overload without a Rect.

ShaderProperty(Rect, MaterialProperty, GUIContent, int)

Draws the UI for a shader property with an indented label and tooltip, at a specified position.
public void ShaderProperty(Rect position, MaterialProperty prop, GUIContent label, int labelIndent)

Parameters

position

The position and size of the control.

The material property to draw UI for.

The label to show for the property, including any tooltip.

labelIndent

The number of levels to indent the label by.

Remarks

This method draws the appropriate UI for the type of the shader property. It applies any custom MaterialPropertyDrawer that the shader defines for the property. To draw the default UI without custom drawers, use MaterialEditor.DefaultShaderProperty. This overload draws the control at
position
. To use automatic layout, use the overload without a Rect.

ShaderProperty(Shader, int)

Handles UI for one shader property, specified by property index.
Warning
Deprecated. Use ShaderProperty that takes MaterialProperty parameter instead.
public void ShaderProperty(Shader shader, int propertyIndex)

Parameters

shader

The shader that the property belongs to.

propertyIndex

The index of the property.

Remarks

This overload is obsolete. Use MaterialEditor.ShaderProperty(MaterialProperty, string) instead.