diff --git a/Source/Editor/CustomEditors/Editors/IntegerEditor.cs b/Source/Editor/CustomEditors/Editors/IntegerEditor.cs
index 46c6fafe7..3c2ca8872 100644
--- a/Source/Editor/CustomEditors/Editors/IntegerEditor.cs
+++ b/Source/Editor/CustomEditors/Editors/IntegerEditor.cs
@@ -109,8 +109,7 @@ namespace FlaxEditor.CustomEditors.Editors
// Use int value editor with limit
var element = layout.SignedIntegerValue();
element.LongValue.SetLimits((LimitAttribute)limit);
- element.LongValue.MinValue = Mathf.Max(element.LongValue.MinValue, min);
- element.LongValue.MaxValue = Mathf.Min(element.LongValue.MaxValue, max);
+ element.LongValue.SetLimits(Mathf.Max(element.LongValue.MinValue, min), Mathf.Min(element.LongValue.MaxValue, max));
element.LongValue.ValueChanged += OnValueChanged;
element.LongValue.SlidingEnd += ClearToken;
_element = element;
@@ -121,8 +120,7 @@ namespace FlaxEditor.CustomEditors.Editors
{
// Use int value editor
var element = layout.SignedIntegerValue();
- element.LongValue.MinValue = Mathf.Max(element.LongValue.MinValue, min);
- element.LongValue.MaxValue = Mathf.Min(element.LongValue.MaxValue, max);
+ element.LongValue.SetLimits(Mathf.Max(element.LongValue.MinValue, min), Mathf.Min(element.LongValue.MaxValue, max));
element.LongValue.ValueChanged += OnValueChanged;
element.LongValue.SlidingEnd += ClearToken;
_element = element;
@@ -278,8 +276,7 @@ namespace FlaxEditor.CustomEditors.Editors
// Use int value editor with limit
var element = layout.UnsignedIntegerValue();
element.ULongValue.SetLimits((LimitAttribute)limit);
- element.ULongValue.MinValue = Mathf.Max(element.ULongValue.MinValue, min);
- element.ULongValue.MaxValue = Mathf.Min(element.ULongValue.MaxValue, max);
+ element.ULongValue.SetLimits(Mathf.Max(element.ULongValue.MinValue, min), Mathf.Min(element.ULongValue.MaxValue, max));
element.ULongValue.ValueChanged += OnValueChanged;
element.ULongValue.SlidingEnd += ClearToken;
_element = element;
@@ -290,8 +287,7 @@ namespace FlaxEditor.CustomEditors.Editors
{
// Use int value editor
var element = layout.UnsignedIntegerValue();
- element.ULongValue.MinValue = Mathf.Max(element.ULongValue.MinValue, min);
- element.ULongValue.MaxValue = Mathf.Min(element.ULongValue.MaxValue, max);
+ element.ULongValue.SetLimits(Mathf.Max(element.ULongValue.MinValue, min), Mathf.Min(element.ULongValue.MaxValue, max));
element.ULongValue.ValueChanged += OnValueChanged;
element.ULongValue.SlidingEnd += ClearToken;
_element = element;
diff --git a/Source/Editor/GUI/Input/LongValueBox.cs b/Source/Editor/GUI/Input/LongValueBox.cs
index a2fb52fda..498d58d07 100644
--- a/Source/Editor/GUI/Input/LongValueBox.cs
+++ b/Source/Editor/GUI/Input/LongValueBox.cs
@@ -93,6 +93,18 @@ namespace FlaxEditor.GUI.Input
Value = Value;
}
+ ///
+ /// Sets the limits at once.
+ ///
+ /// The minimum value.
+ /// The minimum value.
+ public void SetLimits(long min, long max)
+ {
+ _min = Math.Min(min, max);
+ _max = Math.Max(min, max);
+ Value = Value;
+ }
+
///
protected sealed override void UpdateText()
{
diff --git a/Source/Editor/GUI/Input/ULongValueBox.cs b/Source/Editor/GUI/Input/ULongValueBox.cs
index 55090fc98..228778c97 100644
--- a/Source/Editor/GUI/Input/ULongValueBox.cs
+++ b/Source/Editor/GUI/Input/ULongValueBox.cs
@@ -88,12 +88,24 @@ namespace FlaxEditor.GUI.Input
/// The limits.
public void SetLimits(LimitAttribute limits)
{
- _min = limits.Min == int.MinValue ? ulong.MinValue : (ulong)limits.Min;
- _max = Math.Max(_min, limits.Max == int.MaxValue ? ulong.MaxValue : (ulong)limits.Max);
+ _min = limits.Min < 0.0f ? 0 : (ulong)limits.Min;
+ _max = Math.Max(_min, limits.Max == float.MaxValue ? ulong.MaxValue : (ulong)limits.Max);
_slideSpeed = limits.SliderSpeed;
Value = Value;
}
+ ///
+ /// Sets the limits at once.
+ ///
+ /// The minimum value.
+ /// The minimum value.
+ public void SetLimits(ulong min, ulong max)
+ {
+ _min = Math.Min(min, max);
+ _max = Math.Max(min, max);
+ Value = Value;
+ }
+
///
protected sealed override void UpdateText()
{
diff --git a/Source/Editor/Surface/VisjectSurfaceWindow.cs b/Source/Editor/Surface/VisjectSurfaceWindow.cs
index 0c26c9237..38415565a 100644
--- a/Source/Editor/Surface/VisjectSurfaceWindow.cs
+++ b/Source/Editor/Surface/VisjectSurfaceWindow.cs
@@ -332,7 +332,10 @@ namespace FlaxEditor.Surface
///
public class ParametersEditor : CustomEditor
{
- private static readonly Attribute[] DefaultAttributes = { new LimitAttribute(float.MinValue, float.MaxValue, 0.1f) };
+ private static readonly Attribute[] DefaultAttributes =
+ {
+ //new LimitAttribute(float.MinValue, float.MaxValue, 0.1f),
+ };
///
public override DisplayStyle Style => DisplayStyle.InlineIntoParent;