diff --git a/Source/Editor/GUI/Input/ValueBox.cs b/Source/Editor/GUI/Input/ValueBox.cs index 8ee1c3887..d34acd17b 100644 --- a/Source/Editor/GUI/Input/ValueBox.cs +++ b/Source/Editor/GUI/Input/ValueBox.cs @@ -49,6 +49,11 @@ namespace FlaxEditor.GUI.Input /// protected T _startSlideValue; + /// + /// The text cached on editing start. Used to compare with the end result to detect changes. + /// + protected string _startEditText; + private Vector2 _startSlideLocation; /// @@ -257,11 +262,23 @@ namespace FlaxEditor.GUI.Input return base.OnMouseUp(location, button); } + /// + protected override void OnEditBegin() + { + base.OnEditBegin(); + + _startEditText = _text; + } + /// protected override void OnEditEnd() { - // Update value - TryGetValue(); + if (_startEditText != _text) + { + // Update value + TryGetValue(); + } + _startEditText = null; base.OnEditEnd(); } diff --git a/Source/Engine/UI/GUI/Common/TextBoxBase.cs b/Source/Engine/UI/GUI/Common/TextBoxBase.cs index 107da6f40..ccf346ed6 100644 --- a/Source/Engine/UI/GUI/Common/TextBoxBase.cs +++ b/Source/Engine/UI/GUI/Common/TextBoxBase.cs @@ -942,6 +942,8 @@ namespace FlaxEngine.GUI { base.OnLostFocus(); + if (IsReadOnly) + return; OnEditEnd(); }