Documentation

Unity Engine

Unity Engine

TextureProperty

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

Definition

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

TextureProperty(MaterialProperty, string)

Draws a field for a texture shader property, using automatic layout.
public Texture TextureProperty(MaterialProperty prop, string label)

Parameters

The material property to edit.

label

The label to show for the property.

Returns

Type

Description

TextureThe texture assigned to the property, which might have changed if the user interacted with the control.

Remarks

Use this method in a custom material editor to draw a field for a texture shader property. This overload shows the tiling and offset fields unless the shader property has the
[NoScaleOffset]
attribute. This overload uses automatic layout. To set the position and size of the control, use the overload that takes a Rect.

TextureProperty(MaterialProperty, string, bool)

Draws a field for a texture shader property, with or without tiling and offset fields, using automatic layout.
public Texture TextureProperty(MaterialProperty prop, string label, bool scaleOffset)

Parameters

The material property to edit.

label

The label to show for the property.

scaleOffset

Set to true to show the tiling and offset fields. Set to false to hide them.

Returns

Type

Description

TextureThe texture assigned to the property, which might have changed if the user interacted with the control.

Remarks

Use this method in a custom material editor to draw a field for a texture shader property. This overload uses automatic layout. To set the position and size of the control, use the overload that takes a Rect.

TextureProperty(Rect, MaterialProperty, string)

Draws a field for a texture shader property at a specified position.
public Texture TextureProperty(Rect position, MaterialProperty prop, string label)

Parameters

position

The position and size of the control.

The material property to edit.

label

The label to show for the property.

Returns

Type

Description

TextureThe texture assigned to the property, which might have changed if the user interacted with the control.

Remarks

Use this method in a custom material editor to draw a field for a texture shader property. This overload shows the tiling and offset fields unless the shader property has the
[NoScaleOffset]
attribute. This overload draws the control at
position
. To use automatic layout, use the overload without a Rect.

TextureProperty(Rect, MaterialProperty, GUIContent)

Draws a field for a texture shader property with a label and tooltip, at a specified position.
public Texture TextureProperty(Rect position, MaterialProperty prop, GUIContent label)

Parameters

position

The position and size of the control.

The material property to edit.

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

Returns

Type

Description

TextureThe texture assigned to the property, which might have changed if the user interacted with the control.

Remarks

Use this method in a custom material editor to draw a field for a texture shader property. This overload shows the tiling and offset fields unless the shader property has the
[NoScaleOffset]
attribute. This overload draws the control at
position
. To use automatic layout, use the overload without a Rect.

TextureProperty(Rect, MaterialProperty, string, bool)

Draws a field for a texture shader property at a specified position, with or without tiling and offset fields.
public Texture TextureProperty(Rect position, MaterialProperty prop, string label, bool scaleOffset)

Parameters

position

The position and size of the control.

The material property to edit.

label

The label to show for the property.

scaleOffset

Set to true to show the tiling and offset fields. Set to false to hide them.

Returns

Type

Description

TextureThe texture assigned to the property, which might have changed if the user interacted with the control.

Remarks

Use this method in a custom material editor to draw a field for a texture shader property. This overload draws the control at
position
. To use automatic layout, use the overload without a Rect.

TextureProperty(Rect, MaterialProperty, string, string, bool)

Draws a field for a texture shader property with a separate label and tooltip, at a specified position.
public Texture TextureProperty(Rect position, MaterialProperty prop, string label, string tooltip, bool scaleOffset)

Parameters

position

The position and size of the control.

The material property to edit.

label

The label to show for the property.

tooltip

The tooltip to show for the property.

scaleOffset

Set to true to show the tiling and offset fields. Set to false to hide them.

Returns

Type

Description

TextureThe texture assigned to the property, which might have changed if the user interacted with the control.

Remarks

Use this method in a custom material editor to draw a field for a texture shader property. This overload draws the control at
position
. To use automatic layout, use the overload without a Rect.

TextureProperty(Rect, MaterialProperty, GUIContent, bool)

Draws a field for a texture shader property with a label and tooltip, at a specified position, with or without tiling and offset fields.
public Texture TextureProperty(Rect position, MaterialProperty prop, GUIContent label, bool scaleOffset)

Parameters

position

The position and size of the control.

The material property to edit.

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

scaleOffset

Set to true to show the tiling and offset fields. Set to false to hide them.

Returns

Type

Description

TextureThe texture assigned to the property, which might have changed if the user interacted with the control.

Remarks

Use this method in a custom material editor to draw a field for a texture shader property. This overload draws the control at
position
. To use automatic layout, use the overload without a Rect.

TextureProperty(string, string, ShaderPropertyTexDim)

Draw a property field for a texture shader property, specified by name.
Warning
Removed. Use TextureProperty with MaterialProperty instead.
public Texture TextureProperty(string propertyName, string label, ShaderUtil.ShaderPropertyTexDim texDim)

Parameters

propertyName

The name of the shader property.

label

Label for the field.

texDim

ShaderPropertyTexDim
This parameter isn't used.

Returns

Type

Description

TextureThe texture assigned to the property, which might have been changed by the user interacting with the control.

Remarks

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

TextureProperty(string, string, ShaderPropertyTexDim, bool)

Draw a property field for a texture shader property, specified by name.
Warning
Removed. Use TextureProperty with MaterialProperty instead.
public Texture TextureProperty(string propertyName, string label, ShaderUtil.ShaderPropertyTexDim texDim, bool scaleOffset)

Parameters

propertyName

The name of the shader property.

label

Label for the field.

texDim

ShaderPropertyTexDim
This parameter isn't used.

scaleOffset

Draw scale / offset.

Returns

Type

Description

TextureThe texture assigned to the property, which might have been changed by the user interacting with the control.

Remarks