fix: "extract menu to objects" does not set the target of its menu group properly (#1304)

Closes: #1297
This commit is contained in:
bd_ 2024-10-19 17:46:39 -07:00 committed by GitHub
parent 11a62c88d4
commit 5bafb0ba9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -368,7 +368,7 @@ namespace nadena.dev.modular_avatar.core.editor
serializedObject.ApplyModifiedProperties(); serializedObject.ApplyModifiedProperties();
Localization.ShowLanguageUI(); ShowLanguageUI();
} }
private string ObjectHierarchyOrder(Component arg) private string ObjectHierarchyOrder(Component arg)
@ -415,6 +415,9 @@ namespace nadena.dev.modular_avatar.core.editor
var group = installer.gameObject.AddComponent<ModularAvatarMenuGroup>(); var group = installer.gameObject.AddComponent<ModularAvatarMenuGroup>();
var menuRoot = new GameObject(); var menuRoot = new GameObject();
menuRoot.name = "Menu"; menuRoot.name = "Menu";
group.targetObject = menuRoot;
Undo.RegisterCreatedObjectUndo(menuRoot, "Extract menu"); Undo.RegisterCreatedObjectUndo(menuRoot, "Extract menu");
menuRoot.transform.SetParent(group.transform, false); menuRoot.transform.SetParent(group.transform, false);
foreach (var control in menu.controls) foreach (var control in menu.controls)