diff --git a/Packages/nadena.dev.modular-avatar/Runtime/ArmatureAwase/ArmatureLockController.cs b/Packages/nadena.dev.modular-avatar/Runtime/ArmatureAwase/ArmatureLockController.cs index b6593894..2d1a7e01 100644 --- a/Packages/nadena.dev.modular-avatar/Runtime/ArmatureAwase/ArmatureLockController.cs +++ b/Packages/nadena.dev.modular-avatar/Runtime/ArmatureAwase/ArmatureLockController.cs @@ -74,7 +74,9 @@ namespace nadena.dev.modular_avatar.core.armature_lock public ArmatureLockController(ModularAvatarMergeArmature mama, GetTransformsDelegate getTransforms) { +#if UNITY_EDITOR AssemblyReloadEvents.beforeAssemblyReload += Dispose; +#endif this._mama = mama; this._getTransforms = getTransforms; diff --git a/Packages/nadena.dev.modular-avatar/Runtime/ArmatureAwase/TransformState.cs b/Packages/nadena.dev.modular-avatar/Runtime/ArmatureAwase/TransformState.cs index 18cad3be..1cc928ed 100644 --- a/Packages/nadena.dev.modular-avatar/Runtime/ArmatureAwase/TransformState.cs +++ b/Packages/nadena.dev.modular-avatar/Runtime/ArmatureAwase/TransformState.cs @@ -1,6 +1,5 @@ using System.Runtime.CompilerServices; using Unity.Burst; -using UnityEditor; using UnityEngine; namespace nadena.dev.modular_avatar.core.armature_lock @@ -27,7 +26,9 @@ namespace nadena.dev.modular_avatar.core.armature_lock public void ToTransform(Transform bone) { - Undo.RecordObject(bone, Undo.GetCurrentGroupName()); +#if UNITY_EDITOR + UnityEditor.Undo.RecordObject(bone, UnityEditor.Undo.GetCurrentGroupName()); +#endif bone.localPosition = localPosition; bone.localRotation = localRotation; bone.localScale = localScale; diff --git a/Packages/nadena.dev.modular-avatar/Runtime/MAMoveIndependently.cs b/Packages/nadena.dev.modular-avatar/Runtime/MAMoveIndependently.cs index 003c794e..9591ce6a 100644 --- a/Packages/nadena.dev.modular-avatar/Runtime/MAMoveIndependently.cs +++ b/Packages/nadena.dev.modular-avatar/Runtime/MAMoveIndependently.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using UnityEditor; using UnityEngine; using VRC.SDKBase; @@ -121,9 +120,9 @@ namespace nadena.dev.modular_avatar.core.ArmatureAwase if (deltaPos.sqrMagnitude < EPSILON && deltaRot < EPSILON && deltaScale < EPSILON) { Matrix4x4 childNewLocal = parent.worldToLocalMatrix * state.childWorld; - - Undo.RecordObject(child, Undo.GetCurrentGroupName()); - +#if UNITY_EDITOR + UnityEditor.Undo.RecordObject(child, UnityEditor.Undo.GetCurrentGroupName()); +#endif child.localPosition = childNewLocal.MultiplyPoint(Vector3.zero); child.localRotation = childNewLocal.rotation; child.localScale = childNewLocal.lossyScale;