diff --git a/Source/Editor/CustomEditors/Editors/DictionaryEditor.cs b/Source/Editor/CustomEditors/Editors/DictionaryEditor.cs index ba66aa0fa..51309a2fa 100644 --- a/Source/Editor/CustomEditors/Editors/DictionaryEditor.cs +++ b/Source/Editor/CustomEditors/Editors/DictionaryEditor.cs @@ -140,6 +140,7 @@ namespace FlaxEditor.CustomEditors.Editors private bool _readOnly; private bool _notNullItems; private bool _canEditKeys; + private bool _keyEdited; /// /// Determines whether this editor[can edit the specified dictionary type. @@ -351,6 +352,7 @@ namespace FlaxEditor.CustomEditors.Editors newValues[e] = dictionary[e]; } SetValue(newValues); + _keyEdited = true; // TODO: use custom UndoAction to rebuild UI after key modification } /// @@ -463,6 +465,13 @@ namespace FlaxEditor.CustomEditors.Editors /// public override void Refresh() { + if (_keyEdited) + { + _keyEdited = false; + RebuildLayout(); + RebuildParentCollection(); + } + base.Refresh(); // No support for different collections for now diff --git a/Source/Editor/CustomEditors/Editors/FloatEditor.cs b/Source/Editor/CustomEditors/Editors/FloatEditor.cs index 63ef35ca9..456eae9ee 100644 --- a/Source/Editor/CustomEditors/Editors/FloatEditor.cs +++ b/Source/Editor/CustomEditors/Editors/FloatEditor.cs @@ -89,7 +89,7 @@ namespace FlaxEditor.CustomEditors.Editors else if (value is double asDouble) _element.Value = (float)asDouble; else - throw new Exception("Invalid value."); + throw new Exception(string.Format("Invalid value type {0}.", value?.GetType().ToString() ?? "")); } } } diff --git a/Source/Editor/CustomEditors/Editors/IntegerEditor.cs b/Source/Editor/CustomEditors/Editors/IntegerEditor.cs index 3c2ca8872..5822b1c83 100644 --- a/Source/Editor/CustomEditors/Editors/IntegerEditor.cs +++ b/Source/Editor/CustomEditors/Editors/IntegerEditor.cs @@ -1,5 +1,6 @@ // Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. +using System; using System.Linq; using FlaxEditor.CustomEditors.Elements; using FlaxEngine; @@ -77,7 +78,13 @@ namespace FlaxEditor.CustomEditors.Editors } else { - _element.Value = (int)Values[0]; + var value = Values[0]; + if (value is int asInt) + _element.Value = asInt; + else if (value is float asFloat) + _element.Value = (int)asFloat; + else + throw new Exception(string.Format("Invalid value type {0}.", value?.GetType().ToString() ?? "")); } } }