diff --git a/Editor/Inspector/BoneProxyEditor.cs b/Editor/Inspector/BoneProxyEditor.cs index f9d3ec6d..22566984 100644 --- a/Editor/Inspector/BoneProxyEditor.cs +++ b/Editor/Inspector/BoneProxyEditor.cs @@ -95,7 +95,7 @@ namespace nadena.dev.modular_avatar.core.editor var t = (ModularAvatarBoneProxy) targets[i]; Undo.RecordObjects(targets, "Set targets"); var xform = ((TempObjRef) objRefs[i]).target; - if (RuntimeUtil.FindAvatarTransformInParents(xform)?.gameObject != parentAvatar) continue; + if (xform != null && RuntimeUtil.FindAvatarTransformInParents(xform)?.gameObject != parentAvatar) continue; t.target = xform; } } @@ -159,4 +159,4 @@ namespace nadena.dev.modular_avatar.core.editor } } } -} \ No newline at end of file +} diff --git a/Runtime/ModularAvatarBoneProxy.cs b/Runtime/ModularAvatarBoneProxy.cs index 35f0cd7d..38957bdc 100644 --- a/Runtime/ModularAvatarBoneProxy.cs +++ b/Runtime/ModularAvatarBoneProxy.cs @@ -205,6 +205,13 @@ namespace nadena.dev.modular_avatar.core Transform iter = newTarget; + if (newTarget == null) + { + boneReference = HumanBodyBones.LastBone; + subPath = null; + return; + } + if (newTarget == avatarTransform) { boneReference = HumanBodyBones.LastBone; @@ -230,4 +237,4 @@ namespace nadena.dev.modular_avatar.core _targetCache = newTarget; } } -} \ No newline at end of file +}