# BeginProperty

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

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/7000.0/script-reference/unityeditor.md)
* **Assembly:** UnityEditor.CoreModule

## BeginProperty(SerializedProperty)

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

```csharp
public static void BeginProperty(SerializedProperty property)
```

### Parameters

**** (\[SerializedProperty]\(/engine/7000.0/script-reference/unityeditor/serializedproperty)): The serialized property for the material setting that the GUI control edits.

### Remarks

[MaterialEditor](/engine/7000.0/script-reference/unityeditor/materialeditor.md) has methods that draw specific material properties, such as [MaterialEditor.ShaderProperty](/engine/7000.0/script-reference/unityeditor/materialeditor/shaderproperty.md) and [MaterialEditor.TextureProperty](/engine/7000.0/script-reference/unityeditor/materialeditor/textureproperty.md). If you draw a property with another GUI control instead, such as [EditorGUI.Toggle](/engine/7000.0/script-reference/unityeditor/editorgui/toggle.md), 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](/engine/7000.0/script-reference/unityeditor/materialeditor/endproperty.md). Use this overload when you draw a control for [Material.renderQueue](/engine/7000.0/script-reference/unityengine/material/renderqueue.md), [Material.doubleSidedGI](/engine/7000.0/script-reference/unityengine/material/doublesidedgi.md), [Material.enableInstancing](/engine/7000.0/script-reference/unityengine/material/enableinstancing.md), or [Material.globalIlluminationFlags](/engine/7000.0/script-reference/unityengine/material/globalilluminationflags.md), and pass the matching [SerializedProperty](/engine/7000.0/script-reference/unityeditor/serializedproperty.md). This overload doesn't take a rectangle, so the Unity Editor uses [GUILayoutUtility.GetLastRect](/engine/7000.0/script-reference/unityengine/guilayoututility/getlastrect.md) at the end of the wrapper to find the position of the control.

## BeginProperty(Rect, SerializedProperty)

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

```csharp
public static void BeginProperty(Rect rect, SerializedProperty property)
```

### Parameters

**** (\[Rect]\(/engine/7000.0/script-reference/unityengine/rect)): The position and size of the GUI control, including any label.**** (\[SerializedProperty]\(/engine/7000.0/script-reference/unityeditor/serializedproperty)): The serialized property for the material setting that the GUI control edits.

### Remarks

[MaterialEditor](/engine/7000.0/script-reference/unityeditor/materialeditor.md) has methods that draw specific material properties, such as [MaterialEditor.ShaderProperty](/engine/7000.0/script-reference/unityeditor/materialeditor/shaderproperty.md) and [MaterialEditor.TextureProperty](/engine/7000.0/script-reference/unityeditor/materialeditor/textureproperty.md). If you draw a property with another GUI control instead, such as [EditorGUI.Toggle](/engine/7000.0/script-reference/unityeditor/editorgui/toggle.md), 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](/engine/7000.0/script-reference/unityeditor/materialeditor/endproperty.md). Use this overload when you draw a control for [Material.renderQueue](/engine/7000.0/script-reference/unityengine/material/renderqueue.md), [Material.doubleSidedGI](/engine/7000.0/script-reference/unityengine/material/doublesidedgi.md), [Material.enableInstancing](/engine/7000.0/script-reference/unityengine/material/enableinstancing.md), or [Material.globalIlluminationFlags](/engine/7000.0/script-reference/unityengine/material/globalilluminationflags.md), and pass the matching [SerializedProperty](/engine/7000.0/script-reference/unityeditor/serializedproperty.md).

## BeginProperty(MaterialProperty)

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

```csharp
public static void BeginProperty(MaterialProperty property)
```

### Parameters

**** (\[MaterialProperty]\(/engine/7000.0/script-reference/unityeditor/materialproperty)): The material property that the GUI control edits.

### Remarks

[MaterialEditor](/engine/7000.0/script-reference/unityeditor/materialeditor.md) has methods that draw specific material properties, such as [MaterialEditor.ShaderProperty](/engine/7000.0/script-reference/unityeditor/materialeditor/shaderproperty.md) and [MaterialEditor.TextureProperty](/engine/7000.0/script-reference/unityeditor/materialeditor/textureproperty.md). If you draw a property with another GUI control instead, such as [EditorGUI.Toggle](/engine/7000.0/script-reference/unityeditor/editorgui/toggle.md), 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](/engine/7000.0/script-reference/unityeditor/materialeditor/endproperty.md). This overload doesn't take a rectangle, so the Unity Editor uses [GUILayoutUtility.GetLastRect](/engine/7000.0/script-reference/unityengine/guilayoututility/getlastrect.md) at the end of the wrapper to find the position of the control.

## BeginProperty(Rect, MaterialProperty)

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

```csharp
public static void BeginProperty(Rect rect, MaterialProperty property)
```

### Parameters

**** (\[Rect]\(/engine/7000.0/script-reference/unityengine/rect)): The position and size of the GUI control, including any label.**** (\[MaterialProperty]\(/engine/7000.0/script-reference/unityeditor/materialproperty)): The material property that the GUI control edits.

### Remarks

[MaterialEditor](/engine/7000.0/script-reference/unityeditor/materialeditor.md) has methods that draw specific material properties, such as [MaterialEditor.ShaderProperty](/engine/7000.0/script-reference/unityeditor/materialeditor/shaderproperty.md) and [MaterialEditor.TextureProperty](/engine/7000.0/script-reference/unityeditor/materialeditor/textureproperty.md). If you draw a property with another GUI control instead, such as [EditorGUI.Toggle](/engine/7000.0/script-reference/unityeditor/editorgui/toggle.md), 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](/engine/7000.0/script-reference/unityeditor/materialeditor/endproperty.md).
