public PropertyScope(SerializedProperty property, GUIContent label) { this.property = property; ToolboxEditorGui.BeginProperty(property, ref label, out var labelRect); HandleEvents(labelRect); TryDrawLabel(labelRect, label); }
protected override void OnGuiSafe(SerializedProperty property, GUIContent label, float minValue, float maxValue) { ToolboxEditorGui.BeginProperty(property, ref label, out var position); EditorGUI.BeginChangeCheck(); switch (property.propertyType) { case SerializedPropertyType.Integer: var intValue = EditorGUI.IntSlider(position, label, property.intValue, (int)minValue, (int)maxValue); if (EditorGUI.EndChangeCheck()) { property.intValue = intValue; } break; case SerializedPropertyType.Float: var floatValue = EditorGUI.Slider(position, label, property.floatValue, minValue, maxValue); if (EditorGUI.EndChangeCheck()) { property.floatValue = floatValue; } break; default: break; } ToolboxEditorGui.CloseProperty(); }
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(); }