public static GUIContent BeginProperty (Rect totalPosition, GUIContent label, SerializedProperty property);


labelスライダーの前のオプションのラベル。 SerializedProperty から名前を使用するためには null を使用します。ラベルを表示させないためには GUIContent.none を使用します。
property制御に使用する SerializedProperty


GUIContent 制御に使用する実際のラベル


SerializedPropertyを GUI で管理しやすくするようにするためのプロパティーのラッパーである GUI グループを作成します

Most EditorGUI and EditorGUILayout GUI controls already have overloads that work with SerializedProperty. However, for GUI controls that don't handle SerializedProperty you can wrap them inside BeginProperty and EndProperty as shown in the example below. You can use this for your own custom GUI controls too.

BeginProperty and EndProperty automatically handle default labels, bold font for Prefab overrides, revert to Prefab right click menu, and setting showMixedValue to true if the values of the property are different when multi-object editing.

using UnityEngine;
using UnityEditor;

class Example : MonoBehaviour { // A slider function that takes a SerializedProperty void Slider(Rect position, SerializedProperty property, float leftValue, float rightValue, GUIContent label) { label = EditorGUI.BeginProperty(position, label, property);

EditorGUI.BeginChangeCheck(); var newValue = EditorGUI.Slider(position, label, property.floatValue, leftValue, rightValue); // Only assign the value back if it was actually changed by the user. // Otherwise a single value will be assigned to all objects when multi-object editing, // even when the user didn't touch the control. if (EditorGUI.EndChangeCheck()) { property.floatValue = newValue; } EditorGUI.EndProperty(); } }

関連項目: EndProperty.