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

MaterialEditor.TextureProperty

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 Texture TextureProperty(MaterialProperty prop, string label);

Parameters

Parameter Description
prop The material property to edit.
label The label to show for the property.

Returns

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

Description

Draws a field for a texture shader property, using automatic layout.

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.


Declaration

public Texture TextureProperty(MaterialProperty prop, string label, bool scaleOffset);

Parameters

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

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

Description

Draws a field for a texture shader property, with or without tiling and offset fields, using automatic layout.

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.


Declaration

public Texture TextureProperty(Rect position, MaterialProperty prop, string label);

Parameters

Parameter Description
position The position and size of the control.
prop The material property to edit.
label The label to show for the property.

Returns

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

Description

Draws a field for a texture shader property at a specified position.

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.


Declaration

public Texture TextureProperty(Rect position, MaterialProperty prop, GUIContent label);

Parameters

Parameter Description
position The position and size of the control.
prop The material property to edit.
label The label to show for the property, including any tooltip.

Returns

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

Description

Draws a field for a texture shader property with a label and tooltip, at a specified position.

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.


Declaration

public Texture TextureProperty(Rect position, MaterialProperty prop, string label, bool scaleOffset);

Parameters

Parameter Description
position The position and size of the control.
prop 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

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

Description

Draws a field for a texture shader property at a specified position, with or without tiling and offset fields.

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.


Declaration

public Texture TextureProperty(Rect position, MaterialProperty prop, GUIContent label, bool scaleOffset);

Parameters

Parameter Description
position The position and size of the control.
prop The material property to edit.
label 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

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

Description

Draws a field for a texture shader property with a label and tooltip, at a specified position, with or without tiling and offset fields.

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.


Declaration

public Texture TextureProperty(Rect position, MaterialProperty prop, string label, string tooltip, bool scaleOffset);

Parameters

Parameter Description
position The position and size of the control.
prop 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

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

Description

Draws a field for a texture shader property with a separate label and tooltip, at a specified position.

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.


Obsolete Use TextureProperty with MaterialProperty instead.

Declaration

public Texture TextureProperty(string propertyName, string label, ShaderPropertyTexDim texDim);

Parameters

Parameter Description
propertyName The name of the shader property.
label Label for the field.
texDim This parameter isn't used.

Returns

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

Description

Draw a property field for a texture shader property, specified by name.

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


Obsolete Use TextureProperty with MaterialProperty instead.

Declaration

public Texture TextureProperty(string propertyName, string label, ShaderPropertyTexDim texDim, bool scaleOffset);

Parameters

Parameter Description
propertyName The name of the shader property.
label Label for the field.
texDim This parameter isn't used.
scaleOffset Draw scale / offset.

Returns

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

Description

Draw a property field for a texture shader property, specified by name.

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