From 54288ebd445f186a8753e6d73042f8a3bc302db5 Mon Sep 17 00:00:00 2001 From: lilxyzw <74490257+lilxyzw@users.noreply.github.com> Date: Mon, 23 Sep 2024 06:35:05 +0900 Subject: [PATCH] fix: MenuInstaller does not support cloning (#1173) (#1184) * fix: MenuInstaller does not support cloning (#1173) * fix: error when root menu is specified --- Editor/Menu/VirtualMenu.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Editor/Menu/VirtualMenu.cs b/Editor/Menu/VirtualMenu.cs index 24b5971f..c50ee654 100644 --- a/Editor/Menu/VirtualMenu.cs +++ b/Editor/Menu/VirtualMenu.cs @@ -7,6 +7,7 @@ using System.Linq; using JetBrains.Annotations; using nadena.dev.modular_avatar.core.menu; using nadena.dev.modular_avatar.editor.ErrorReporting; +using nadena.dev.ndmf; using UnityEngine; using VRC.SDK3.Avatars.Components; using VRC.SDK3.Avatars.ScriptableObjects; @@ -102,7 +103,7 @@ namespace nadena.dev.modular_avatar.core.editor.menu PushControl(control); } - if (_menuToInstallerMap.TryGetValue(expMenu, out var installers)) + if (_menuToInstallerMap.TryGetValue(ObjectRegistry.GetReference(expMenu), out var installers)) { foreach (var installer in installers) { @@ -311,7 +312,7 @@ namespace nadena.dev.modular_avatar.core.editor.menu // initial validation if (installer.menuToAppend == null && installer.GetComponent() == null) return; - var target = installer.installTargetMenu ? (object) installer.installTargetMenu : RootMenuKey; + var target = installer.installTargetMenu ? (object) ObjectRegistry.GetReference(installer.installTargetMenu) : RootMenuKey; if (!_targetMenuToInstaller.TryGetValue(target, out var targets)) { targets = new List(); @@ -366,7 +367,7 @@ namespace nadena.dev.modular_avatar.core.editor.menu } // Some menu installers may be bound to the root menu _asset_ directly. - if (menuToInstallerFiltered.TryGetValue(menu, out var installers)) + if (menuToInstallerFiltered.TryGetValue(ObjectRegistry.GetReference(menu), out var installers)) { foreach (var installer in installers) {