mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-31 02:32:53 +08:00
fix: select menu creates menu install targets in random order (#530)
Fixes: #508
This commit is contained in:
parent
f04171ddb4
commit
1410503609
@ -264,7 +264,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
{
|
{
|
||||||
installTo.objectReferenceValue = null;
|
installTo.objectReferenceValue = null;
|
||||||
|
|
||||||
foreach (var target in targets)
|
foreach (var target in targets.Cast<Component>().OrderBy(ObjectHierarchyOrder))
|
||||||
{
|
{
|
||||||
var installer = (ModularAvatarMenuInstaller) target;
|
var installer = (ModularAvatarMenuInstaller) target;
|
||||||
var child = new GameObject();
|
var child = new GameObject();
|
||||||
@ -371,6 +371,20 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
Localization.ShowLanguageUI();
|
Localization.ShowLanguageUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string ObjectHierarchyOrder(Component arg)
|
||||||
|
{
|
||||||
|
var list = new List<int>();
|
||||||
|
var t = arg.transform;
|
||||||
|
while (t != null)
|
||||||
|
{
|
||||||
|
list.Add(t.GetSiblingIndex());
|
||||||
|
t = t.parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
list.Reverse();
|
||||||
|
return string.Join("", list.Select(n => (char) n));
|
||||||
|
}
|
||||||
|
|
||||||
private void ExtractMenu()
|
private void ExtractMenu()
|
||||||
{
|
{
|
||||||
serializedObject.ApplyModifiedProperties();
|
serializedObject.ApplyModifiedProperties();
|
||||||
|
Loading…
Reference in New Issue
Block a user