// Make your own IMGUI based GUI for the property public override void OnGUI(Rect _position, SerializedProperty _property, GUIContent _label) { Event _current = Event.current; if ((_current.type == EventType.ContextClick) && _position.Contains(_current.mousePosition)) { if (!isMenuInitialized) { menu = new GenericMenu(); menu.AddItem(getPropertyGUI, false, GetReference, _property); } menu.ShowAsContext(); } EditorGUIEnhanced.RequiredProperty(_position, _property, _label); }
// Make your own IMGUI based GUI for the property public override void OnGUI(Rect _position, SerializedProperty _property, GUIContent _label) { EditorGUIEnhanced.RequiredProperty(_position, _property, _label); }
/// <summary> /// Draw a required property field. /// </summary> /// <param name="_property">Property to draw and check validity.</param> /// <param name="_label">Label to display before property.</param> public static void RequiredProperty(SerializedProperty _property, GUIContent _label) { Rect _rect = EditorGUILayout.GetControlRect(true, EditorGUIUtilityEnhanced.GetRequiredPropertyHeight(_property)); EditorGUIEnhanced.RequiredProperty(_rect, _property, _label); }