protected override void OnGuiSafe(SerializedProperty property, GUIContent label, float minValue, float maxValue) { var xValue = property.vector2Value.x; var yValue = property.vector2Value.y; ToolboxEditorGui.BeginProperty(property, ref label, out var position); EditorGUI.BeginChangeCheck(); ToolboxEditorGui.DrawMinMaxSlider(position, label, ref xValue, ref yValue, minValue, maxValue); if (EditorGUI.EndChangeCheck()) { property.vector2Value = new Vector2(xValue, yValue); } ToolboxEditorGui.CloseProperty(); }
protected override void OnGUISafe(Rect position, SerializedProperty property, GUIContent label) { var minValue = Attribute.MinValue; var maxValue = Attribute.MaxValue; var xValue = property.vector2Value.x; var yValue = property.vector2Value.y; label = EditorGUI.BeginProperty(position, label, property); EditorGUI.BeginChangeCheck(); ToolboxEditorGui.DrawMinMaxSlider(position, label, ref xValue, ref yValue, minValue, maxValue); if (EditorGUI.EndChangeCheck()) { property.vector2Value = new Vector2(xValue, yValue); } EditorGUI.EndProperty(); }
protected override void OnGUISafe(Rect position, MaterialProperty prop, string label, MaterialEditor editor) { using (new FixedFieldsScope()) { EditorGUIUtility.labelWidth = 0; var vectorValue = prop.vectorValue; var xValue = vectorValue.x; var yValue = vectorValue.y; EditorGUI.BeginChangeCheck(); ToolboxEditorGui.DrawMinMaxSlider(position, label, ref xValue, ref yValue, minValue, maxValue); if (EditorGUI.EndChangeCheck()) { vectorValue.x = xValue; vectorValue.y = yValue; prop.vectorValue = vectorValue; } } }