Fix UIControl setup on IsActive changes

#326
This commit is contained in:
2021-03-18 10:56:48 +01:00
parent a21f6d1b9f
commit 845da14e6a
2 changed files with 8 additions and 2 deletions
+2 -2
View File
@@ -195,8 +195,8 @@ void UIControl::OnOrderInParentChanged()
void UIControl::OnActiveInTreeChanged()
{
UICONTROL_INVOKE(ActiveInTreeChanged);
// Base
Actor::OnActiveInTreeChanged();
UICONTROL_INVOKE(ActiveInTreeChanged);
}
+6
View File
@@ -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;