Fix UIControl linkage to Prefab window when creating UI within prefab Editor

#1007
This commit is contained in:
Wojtek Figat
2023-05-08 19:22:23 +02:00
parent 3ea771fe22
commit 8edc154501
3 changed files with 28 additions and 8 deletions

View File

@@ -655,7 +655,9 @@ namespace FlaxEditor.CustomEditors.Dedicated
if (uiControl.Name.StartsWith(previousName))
{
string newName = controlType.Name + uiControl.Name.Substring(previousName.Length);
uiControl.Name = StringUtils.IncrementNameNumber(newName, x => uiControl.Parent.GetChild(x) == null);
if (uiControl.Parent != null)
newName = StringUtils.IncrementNameNumber(newName, x => uiControl.Parent.GetChild(x) == null);
uiControl.Name = newName;
}
}