diff --git a/Source/Editor/Surface/AttributesEditor.cs b/Source/Editor/Surface/AttributesEditor.cs index 29d5860c3..4f98ef81b 100644 --- a/Source/Editor/Surface/AttributesEditor.cs +++ b/Source/Editor/Surface/AttributesEditor.cs @@ -124,19 +124,18 @@ namespace FlaxEditor.Surface }; editor.Select(_proxy); - _presenter.Modified += OnPresenterModified; - OnPresenterModified(); + _presenter.AfterLayout += OnPresenterLayer; } - private void OnPresenterModified() + private void OnPresenterLayer(LayoutElementsContainer layout) { if (_proxy.Value.Length == 0) { - var label = _presenter.Label("No attributes.\nPress the \"+\" button to add a new one and then select an attribute type using the \"Type\" dropdown.", TextAlignment.Center); - label.Label.Wrapping = TextWrapping.WrapWords; - label.Control.Height = 35f; - label.Label.Margin = new Margin(10f); - label.Label.TextColor = label.Label.TextColorHighlighted = Style.Current.ForegroundGrey; + var label = layout.Label("No attributes.\nPress the \"+\" button to add a new one and then select an attribute type using the \"Type\" dropdown.", TextAlignment.Center).Label; + label.Wrapping = TextWrapping.WrapWords; + label.Height = 45f; + label.Margin = new Margin(10f); + label.TextColor = label.TextColorHighlighted = Style.Current.ForegroundGrey; } } @@ -186,11 +185,14 @@ namespace FlaxEditor.Surface /// public override void OnDestroy() { - _presenter = null; + if (_presenter != null) + { + _presenter.AfterLayout -= OnPresenterLayer; + _presenter = null; + } _oldData = null; _proxy = null; Edited = null; - _presenter.Modified -= OnPresenterModified; base.OnDestroy(); }