diff --git a/Source/Engine/UI/UIControl.cpp b/Source/Engine/UI/UIControl.cpp index 106e51d63..6c24be02f 100644 --- a/Source/Engine/UI/UIControl.cpp +++ b/Source/Engine/UI/UIControl.cpp @@ -195,8 +195,8 @@ void UIControl::OnOrderInParentChanged() void UIControl::OnActiveInTreeChanged() { + UICONTROL_INVOKE(ActiveInTreeChanged); + // Base Actor::OnActiveInTreeChanged(); - - UICONTROL_INVOKE(ActiveInTreeChanged); } diff --git a/Source/Engine/UI/UIControl.cs b/Source/Engine/UI/UIControl.cs index 04194cf69..b8f8b00dd 100644 --- a/Source/Engine/UI/UIControl.cs +++ b/Source/Engine/UI/UIControl.cs @@ -328,6 +328,12 @@ namespace FlaxEngine { if (_control != null && !_blockEvents) { + // Skip if this control is inactive and it's parent too (parent will unlink from hierarchy but children will stay connected while being inactive) + if (!IsActiveInHierarchy && Parent && !Parent.IsActive) + { + return; + } + // Link or unlink control (won't modify Enable/Visible state) _control.Parent = GetParent(); _control.IndexInParent = OrderInParent;