mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-30 10:12:59 +08:00
fix: NREs when MenuItemGUI is used outside of an avatar
This commit is contained in:
parent
a71af7ae0a
commit
0723a33017
@ -646,6 +646,13 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
var myMenuItem = serializedObject.targetObject as ModularAvatarMenuItem;
|
||||
if (myMenuItem == null) return null;
|
||||
|
||||
var avatarRoot = RuntimeUtil.FindAvatarInParents(myMenuItem.gameObject.transform);
|
||||
|
||||
if (avatarRoot == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var myParameterName = myMenuItem.Control.parameter.name;
|
||||
if (string.IsNullOrEmpty(myParameterName)) return new List<ModularAvatarMenuItem>();
|
||||
|
||||
@ -653,7 +660,6 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
if (myMappings.TryGetValue((ParameterNamespace.Animator, myParameterName), out var myReplacement))
|
||||
myParameterName = myReplacement.ParameterName;
|
||||
|
||||
var avatarRoot = RuntimeUtil.FindAvatarInParents(myMenuItem.gameObject.transform);
|
||||
var siblings = new List<ModularAvatarMenuItem>();
|
||||
|
||||
foreach (var otherMenuItem in avatarRoot.GetComponentsInChildren<ModularAvatarMenuItem>(true))
|
||||
|
Loading…
Reference in New Issue
Block a user