Fix crash in UI prefab changes apply when reparenting controls

#2082
This commit is contained in:
Wojtek Figat
2023-12-17 12:41:51 +01:00
parent 7bcf78d0c0
commit e448692eb9
2 changed files with 9 additions and 5 deletions

View File

@@ -58,10 +58,11 @@ namespace FlaxEngine
if (containerControl != null && IsActiveInHierarchy)
{
var children = ChildrenCount;
var parent = Parent;
for (int i = 0; i < children; i++)
{
var child = GetChild(i) as UIControl;
if (child != null && child.IsActiveInHierarchy && child.HasControl)
if (child != null && child.IsActiveInHierarchy && child.HasControl && child != parent)
{
child.Control.Parent = containerControl;
}