Fix order when pasting UI Controls

#487
This commit is contained in:
Wojtek Figat
2021-04-29 15:22:36 +02:00
parent c2afe0b6b2
commit d2ac0429d3
5 changed files with 49 additions and 9 deletions

View File

@@ -140,22 +140,27 @@ namespace FlaxEditor.Actions
for (int i = 0; i < nodeParents.Count; i++)
{
// Fix name collisions (only for parents)
var node = nodeParents[i];
var parent = node.Actor?.Parent;
if (parent != null)
{
// Fix name collisions
string name = node.Name;
Actor[] children = parent.Children;
if (children.Any(x => x.Name == name))
{
// Generate new name
node.Actor.Name = StringUtils.IncrementNameNumber(name, x => children.All(y => y.Name != x));
}
}
Editor.Instance.Scene.MarkSceneEdited(node.ParentScene);
}
for (int i = 0; i < nodeParents.Count; i++)
{
var node = nodeParents[i];
node.PostPaste();
}
}
/// <summary>