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

MaterialEditor.BeginProperty

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 static void BeginProperty(MaterialProperty property);

Parameters

Parameter Description
property The material property that the GUI control edits.

Description

Starts a property wrapper for a GUI control that edits a material property, using automatic layout.

MaterialEditor has methods that draw specific material properties, such as MaterialEditor.ShaderProperty and MaterialEditor.TextureProperty. If you draw a property with another GUI control instead, such as EditorGUI.Toggle, wrap the control in a property wrapper to get the standard behavior. The wrapper shows material variant overrides in bold, adds the Apply and Revert options to the context menu, disables the control for locked properties, and handles editing multiple different values. End the wrapper with MaterialEditor.EndProperty. This overload doesn't take a rectangle, so the Unity Editor uses GUILayoutUtility.GetLastRect at the end of the wrapper to find the position of the control.


Declaration

public static void BeginProperty(Rect rect, MaterialProperty property);

Parameters

Parameter Description
rect The position and size of the GUI control, including any label.
property The material property that the GUI control edits.

Description

Starts a property wrapper for a GUI control that edits a material property, at a specified position.

MaterialEditor has methods that draw specific material properties, such as MaterialEditor.ShaderProperty and MaterialEditor.TextureProperty. If you draw a property with another GUI control instead, such as EditorGUI.Toggle, wrap the control in a property wrapper to get the standard behavior. The wrapper shows material variant overrides in bold, adds the Apply and Revert options to the context menu, disables the control for locked properties, and handles editing multiple different values. End the wrapper with MaterialEditor.EndProperty.


Declaration

public static void BeginProperty(SerializedProperty property);

Parameters

Parameter Description
property The serialized property for the material setting that the GUI control edits.

Description

Starts a property wrapper for a GUI control that edits a serialized material setting, using automatic layout.

MaterialEditor has methods that draw specific material properties, such as MaterialEditor.ShaderProperty and MaterialEditor.TextureProperty. If you draw a property with another GUI control instead, such as EditorGUI.Toggle, wrap the control in a property wrapper to get the standard behavior. The wrapper shows material variant overrides in bold, adds the Apply and Revert options to the context menu, disables the control for locked properties, and handles editing multiple different values. End the wrapper with MaterialEditor.EndProperty. Use this overload when you draw a control for Material.renderQueue, Material.doubleSidedGI, Material.enableInstancing, or Material.globalIlluminationFlags, and pass the matching SerializedProperty. This overload doesn't take a rectangle, so the Unity Editor uses GUILayoutUtility.GetLastRect at the end of the wrapper to find the position of the control.


Declaration

public static void BeginProperty(Rect rect, SerializedProperty property);

Parameters

Parameter Description
rect The position and size of the GUI control, including any label.
property The serialized property for the material setting that the GUI control edits.

Description

Starts a property wrapper for a GUI control that edits a serialized material setting, at a specified position.

MaterialEditor has methods that draw specific material properties, such as MaterialEditor.ShaderProperty and MaterialEditor.TextureProperty. If you draw a property with another GUI control instead, such as EditorGUI.Toggle, wrap the control in a property wrapper to get the standard behavior. The wrapper shows material variant overrides in bold, adds the Apply and Revert options to the context menu, disables the control for locked properties, and handles editing multiple different values. End the wrapper with MaterialEditor.EndProperty. Use this overload when you draw a control for Material.renderQueue, Material.doubleSidedGI, Material.enableInstancing, or Material.globalIlluminationFlags, and pass the matching SerializedProperty.