文档

Unity Engine

Unity Engine

VectorProperty

Draws a field for a vector shader property, using automatic layout.
阅读时间3 分钟最后更新于 21 天前

Definition

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

VectorProperty(MaterialProperty, string)

Draws a field for a vector shader property, using automatic layout.
public Vector4 VectorProperty(MaterialProperty prop, string label)

Parameters

The material property to edit.

label

The label to show for the property.

Returns

Type

Description

Vector4The value of 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 vector shader property. This overload uses automatic layout. To set the position and size of the control, use the overload that takes a Rect.

VectorProperty(MaterialProperty, GUIContent)

Draws a field for a vector shader property with a label and tooltip, using automatic layout.
public Vector4 VectorProperty(MaterialProperty prop, GUIContent label)

Parameters

The material property to edit.

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

Returns

Type

Description

Vector4The value of 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 vector shader property. This overload uses automatic layout. To set the position and size of the control, use the overload that takes a Rect.

VectorProperty(Rect, MaterialProperty, string)

Draws a field for a vector shader property at a specified position.
public Vector4 VectorProperty(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

Vector4The value of 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 vector shader property. This overload draws the control at
position
. To use automatic layout, use the overload without a Rect.

VectorProperty(Rect, MaterialProperty, GUIContent)

Draws a field for a vector shader property with a label and tooltip, at a specified position.
public Vector4 VectorProperty(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

Vector4The value of 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 vector shader property. This overload draws the control at
position
. To use automatic layout, use the overload without a Rect.

VectorProperty(string, string)

Draw a property field for a vector shader property, specified by name.
警告
Deprecated. Use VectorProperty with MaterialProperty instead.
public Vector4 VectorProperty(string propertyName, string label)

Parameters

propertyName

The name of the shader property.

label

Label for the field.

Returns

Type

Description

Vector4The value of the property, which might have been changed by the user interacting with the control.

Remarks

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