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
Returns
Type | Description |
|---|---|
| Texture | The 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 attribute. This overload uses automatic layout. To set the position and size of the control, use the overload that takes a Rect.
[NoScaleOffset]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.
The label to show for the property.
Set to true to show the tiling and offset fields. Set to false to hide them.
Returns
Type | Description |
|---|---|
| Texture | The 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
The position and size of the control.
The material property to edit.
The label to show for the property.
Returns
Type | Description |
|---|---|
| Texture | The 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 attribute. This overload draws the control at . To use automatic layout, use the overload without a Rect.
[NoScaleOffset]positionTextureProperty(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
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 |
|---|---|
| Texture | The 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 attribute. This overload draws the control at . To use automatic layout, use the overload without a Rect.
[NoScaleOffset]positionTextureProperty(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
The position and size of the control.
The material property to edit.
The label to show for the property.
Set to true to show the tiling and offset fields. Set to false to hide them.
Returns
Type | Description |
|---|---|
| Texture | The 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 . To use automatic layout, use the overload without a Rect.
positionTextureProperty(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
The position and size of the control.
The material property to edit.
The label to show for the property.
The tooltip to show for the property.
Set to true to show the tiling and offset fields. Set to false to hide them.
Returns
Type | Description |
|---|---|
| Texture | The 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 . To use automatic layout, use the overload without a Rect.
positionTextureProperty(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
The position and size of the control.
The material property to edit.
The label to show for the property, including any tooltip.
Set to true to show the tiling and offset fields. Set to false to hide them.
Returns
Type | Description |
|---|---|
| Texture | The 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 . To use automatic layout, use the overload without a Rect.
positionTextureProperty(string, string, ShaderPropertyTexDim)
Draw a property field for a texture shader property, specified by name.
public Texture TextureProperty(string propertyName, string label, ShaderUtil.ShaderPropertyTexDim texDim)
Parameters
Returns
Type | Description |
|---|---|
| Texture | The 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.
public Texture TextureProperty(string propertyName, string label, ShaderUtil.ShaderPropertyTexDim texDim, bool scaleOffset)
Parameters
Returns
Type | Description |
|---|---|
| Texture | The 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, bool) instead.