diff --git a/Packages/net.fushizen.modular-avatar/Runtime/ModularAvatarMergeArmature.cs b/Packages/net.fushizen.modular-avatar/Runtime/ModularAvatarMergeArmature.cs index 862446bb..184bf163 100644 --- a/Packages/net.fushizen.modular-avatar/Runtime/ModularAvatarMergeArmature.cs +++ b/Packages/net.fushizen.modular-avatar/Runtime/ModularAvatarMergeArmature.cs @@ -35,8 +35,8 @@ namespace net.fushizen.modular_avatar.core [DisallowMultipleComponent] public class ModularAvatarMergeArmature : AvatarTagComponent { - private const float POS_EPSILON = 0.01f; - private const float ROT_EPSILON = 0.01f; + private const float POS_EPSILON = 0.001f * 0.001f; + private const float ROT_EPSILON = 0.001f * 0.001f; public AvatarObjectReference mergeTarget; public GameObject mergeTargetObject => mergeTarget.Get(this); @@ -86,7 +86,7 @@ namespace net.fushizen.modular_avatar.core void EditorUpdate() { - if (this == null || lockedBones == null) + if (this == null) { #if UNITY_EDITOR EditorApplication.update -= EditorUpdate; @@ -94,6 +94,11 @@ namespace net.fushizen.modular_avatar.core return; } + if (!locked || lockedBones == null) + { + CheckLock(); + } + if (lockedBones != null) { foreach (var bone in lockedBones) @@ -158,6 +163,8 @@ namespace net.fushizen.modular_avatar.core { Transform baseObject = FindCorresponding(xform); + if (baseObject == null) continue; + lockedBones.Add(new BoneBinding() { baseBone = baseObject, @@ -171,7 +178,7 @@ namespace net.fushizen.modular_avatar.core } #if UNITY_EDITOR - if (locked) + if (shouldLock) { EditorApplication.update += EditorUpdate; }