diff --git a/UnityProjects/MRTKDevTemplate/Assets/Scripts/EyeTracking/TargetPositioning/MoveObjectByEyeGaze.cs b/UnityProjects/MRTKDevTemplate/Assets/Scripts/EyeTracking/TargetPositioning/MoveObjectByEyeGaze.cs index de7fd1c89..9d35cedd0 100644 --- a/UnityProjects/MRTKDevTemplate/Assets/Scripts/EyeTracking/TargetPositioning/MoveObjectByEyeGaze.cs +++ b/UnityProjects/MRTKDevTemplate/Assets/Scripts/EyeTracking/TargetPositioning/MoveObjectByEyeGaze.cs @@ -1,4 +1,4 @@ -// Copyright (c) Mixed Reality Toolkit Contributors +// Copyright (c) Mixed Reality Toolkit Contributors // Licensed under the BSD 3-Clause using MixedReality.Toolkit.Input; @@ -112,7 +112,7 @@ public class MoveObjectByEyeGaze : StatefulInteractable /// Limits the Z position of the GameObject to the specified minimum and maximum. /// public Vector2 LocalMinMaxZ = new Vector2(float.NegativeInfinity, float.PositiveInfinity); - + [Tooltip("Fired when the GameObject is dropped.")] [SerializeField] private UnityEvent onDrop = null; @@ -123,7 +123,7 @@ public class MoveObjectByEyeGaze : StatefulInteractable private bool onlyEyeWarpOnRelease = - true; // Only warp the currently grabbed target to the current look at location once the user releases the pinch gesture. + true; // Only warp the currently grabbed target to the current look at location once the user releases the pinch gesture. private float originalTransparency = -1f; private bool originalUseGravity = false; @@ -366,13 +366,13 @@ private bool IsLookingAwayFromTarget() // Check whether the user is still looking within the proximity of the target float distanceBetweenTargetAndCurrHitPos = Angle_ToCurrHitTarget(gameObject); - // **Note for potential improvement**: It would be better to make this dependent on the target's boundary + // **Note for potential improvement**: It would be better to make this dependent on the target's boundary // instead of its center. The way it is implemented right now may cause problems for large-scale targets. return distanceBetweenTargetAndCurrHitPos > minLookAwayDistToEnableEyeWarp; } /// - /// Determine whether the user is looking away from the preview. + /// Determine whether the user is looking away from the preview. /// private bool IsLookingAwayFromPreview() { @@ -405,7 +405,7 @@ private bool IsLookingAwayFromPreview() /// /// Check if the destination is plausible. For example, this means if the target is placeable - /// on horizontal surfaces then only show a preview for (more or less) horizontal surfaces. + /// on horizontal surfaces then only show a preview for (more or less) horizontal surfaces. /// /// True if the target can be placed on this surface. private bool IsDestinationPlausible() @@ -488,10 +488,15 @@ private void DragAndDrop_Start() if (TryGetComponent(out var rigidbody)) { originalUseGravity = rigidbody.useGravity; - originalDrag = rigidbody.drag; - rigidbody.useGravity = false; + +#if UNITY_6000_0_OR_NEWER + originalDrag = rigidbody.linearDamping; + rigidbody.linearDamping = float.PositiveInfinity; +#else + originalDrag = rigidbody.drag; rigidbody.drag = float.PositiveInfinity; +#endif } } } @@ -520,7 +525,11 @@ private void DragAndDrop_Finish() if (TryGetComponent(out var rigidbody)) { rigidbody.useGravity = originalUseGravity; +#if UNITY_6000_0_OR_NEWER + rigidbody.linearDamping = originalDrag; +#else rigidbody.drag = originalDrag; +#endif } onDrop.Invoke(); diff --git a/UnityProjects/MRTKDevTemplate/Assets/Scripts/TetheredPlacement.cs b/UnityProjects/MRTKDevTemplate/Assets/Scripts/TetheredPlacement.cs index 369052736..46fcb32c4 100644 --- a/UnityProjects/MRTKDevTemplate/Assets/Scripts/TetheredPlacement.cs +++ b/UnityProjects/MRTKDevTemplate/Assets/Scripts/TetheredPlacement.cs @@ -1,4 +1,4 @@ -// Copyright (c) Mixed Reality Toolkit Contributors +// Copyright (c) Mixed Reality Toolkit Contributors // Licensed under the BSD 3-Clause // Disable "missing XML comment" warning for samples. While nice to have, this XML documentation is not required for samples. @@ -49,7 +49,11 @@ private void LateUpdate() // Reset any velocity from falling or moving when re-spawning to original location if (rigidBody != null) { +#if UNITY_6000_0_OR_NEWER + rigidBody.linearVelocity = Vector3.zero; +#else rigidBody.velocity = Vector3.zero; +#endif rigidBody.angularVelocity = Vector3.zero; } diff --git a/org.mixedrealitytoolkit.core/CHANGELOG.md b/org.mixedrealitytoolkit.core/CHANGELOG.md index 95f237481..13f18dfbb 100644 --- a/org.mixedrealitytoolkit.core/CHANGELOG.md +++ b/org.mixedrealitytoolkit.core/CHANGELOG.md @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). * Fixed "The type `MixedReality.Toolkit.Core MixedReality.Toolkit.Experimental.BubbleChildHoverEvents/TrickleChildHoverEvents/BubbleChildSelectEvents/TrickleChildSelectEvents` is being serialized by `[SerializeReference]`, but is missing the `[Serializable]` attribute." on Unity 6.3. [PR #1107](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1107) * Fixed object identity API usages and obsolete sorting warnings for Unity 6.4 and newer in `FindObjectUtility`. [PR #1136](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1136) +* Fixed incomplete serialization hierarchy warnings (UAC1002) in Unity 6 for `InteractableEventRoute`, `InteractableParentEventRoute`, and `InteractableChildrenEventRoute` in `InteractableEventRouter`. [PR #1137](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1137) ## Deprecated diff --git a/org.mixedrealitytoolkit.core/Experimental/Interactables/InteractableEventRouter.cs b/org.mixedrealitytoolkit.core/Experimental/Interactables/InteractableEventRouter.cs index 6de66d2b2..24471627a 100644 --- a/org.mixedrealitytoolkit.core/Experimental/Interactables/InteractableEventRouter.cs +++ b/org.mixedrealitytoolkit.core/Experimental/Interactables/InteractableEventRouter.cs @@ -1,4 +1,4 @@ -// Copyright (c) Mixed Reality Toolkit Contributors +// Copyright (c) Mixed Reality Toolkit Contributors // Licensed under the BSD 3-Clause using System; @@ -496,6 +496,7 @@ public interface IXRSelectInteractableChild : IXRInteractableEventRouteTarget /// For these types of features, we want the community to see them and get /// value out of them early enough so to provide feedback. /// + [Serializable] public abstract class InteractableEventRoute : IXRInteractableEventRoute where S : IXRInteractable where T : IXRInteractableEventRouteTarget @@ -630,6 +631,7 @@ private void FilterTargets(GameObject origin, List targets) /// For these types of features, we want the community to see them and get /// value out of them early enough so to provide feedback. /// + [Serializable] public abstract class InteractableParentEventRoute : InteractableEventRoute where S : IXRInteractable where T : IXRInteractableEventRouteTarget @@ -668,6 +670,7 @@ protected override void GetTargets(GameObject origin, List targets) /// For these types of features, we want the community to see them and get /// value out of them early enough so to provide feedback. /// + [Serializable] public abstract class InteractableChildrenEventRoute : InteractableEventRoute where S : IXRInteractable where T : IXRInteractableEventRouteTarget diff --git a/org.mixedrealitytoolkit.input/CHANGELOG.md b/org.mixedrealitytoolkit.input/CHANGELOG.md index 23b92079a..d4c6d2d99 100644 --- a/org.mixedrealitytoolkit.input/CHANGELOG.md +++ b/org.mixedrealitytoolkit.input/CHANGELOG.md @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). * Fixed "leaked managed shell" issue in `InteractionModeManager`. [PR #1096](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1096) * Fixed `EyeCalibrationChecker` build issue on UWP when the Mixed Reality OpenXR Plugin wasn't installed. [PR #1106](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1106) * Fixed object identity API usages for Unity 6.4 and newer in `InteractionModeManagerEditor`. [PR #1136](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1136) +* Fixed incomplete serialization hierarchy warning (UAC1002) in Unity 6 by adding `[Serializable]` to `HandBasedPoseSource`. [PR #1137](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1137) ## [3.3.0] - 2025-11-12 diff --git a/org.mixedrealitytoolkit.input/Utilities/PoseSource/HandBasedPoseSource.cs b/org.mixedrealitytoolkit.input/Utilities/PoseSource/HandBasedPoseSource.cs index e5aeae5e3..38504d76e 100644 --- a/org.mixedrealitytoolkit.input/Utilities/PoseSource/HandBasedPoseSource.cs +++ b/org.mixedrealitytoolkit.input/Utilities/PoseSource/HandBasedPoseSource.cs @@ -10,6 +10,7 @@ namespace MixedReality.Toolkit.Input /// /// Helps define a pose source that's based on a specific handedness with access to the current . /// + [Serializable] public abstract class HandBasedPoseSource : IPoseSource { /// diff --git a/org.mixedrealitytoolkit.spatialmanipulation/CHANGELOG.md b/org.mixedrealitytoolkit.spatialmanipulation/CHANGELOG.md index 627a89ce4..77f37af81 100644 --- a/org.mixedrealitytoolkit.spatialmanipulation/CHANGELOG.md +++ b/org.mixedrealitytoolkit.spatialmanipulation/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). * Fixed "leaked managed shell" issue in `BoundsCalculator`. [PR #1096](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1096) * Fixed object identity API usages for Unity 6.4 and newer in `ConstraintManagerEditor`. [PR #1136](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1136) +* Fixed obsolete physics property warnings on Unity 6 and newer in `ObjectManipulator`. [PR #1137](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1137) ### Changed diff --git a/org.mixedrealitytoolkit.spatialmanipulation/ObjectManipulator/ObjectManipulator.cs b/org.mixedrealitytoolkit.spatialmanipulation/ObjectManipulator/ObjectManipulator.cs index 72493e963..b08d95ca7 100644 --- a/org.mixedrealitytoolkit.spatialmanipulation/ObjectManipulator/ObjectManipulator.cs +++ b/org.mixedrealitytoolkit.spatialmanipulation/ObjectManipulator/ObjectManipulator.cs @@ -760,7 +760,11 @@ protected override void OnSelectExited(SelectExitEventArgs args) { if (interactorsSelecting.Count == 0) { +#if UNITY_6000_0_OR_NEWER + ReleaseRigidBody(rigidBody.linearVelocity, rigidBody.angularVelocity); +#else ReleaseRigidBody(rigidBody.velocity, rigidBody.angularVelocity); +#endif } else { @@ -908,7 +912,11 @@ private void ApplyForcesToRigidbody() // when player is moving, we need to anticipate where the targetTransform is going to be one time step from now distance -= referenceFrameVelocity * Time.fixedDeltaTime; +#if UNITY_6000_0_OR_NEWER + var velocity = rigidBody.linearVelocity; +#else var velocity = rigidBody.velocity; +#endif var acceleration = omega * omega * -distance; // acceleration caused by spring force @@ -937,7 +945,11 @@ private void ApplyForcesToRigidbody() velocity += referenceFrameVelocity; // change back to global frame of reference +#if UNITY_6000_0_OR_NEWER + rigidBody.linearVelocity = velocity; +#else rigidBody.velocity = velocity; +#endif if (applyTorque) { @@ -1035,7 +1047,11 @@ private void ReleaseRigidBody(Vector3 velocity, Vector3 angularVelocity) { if (releaseBehavior.IsMaskSet(ReleaseBehaviorType.KeepVelocity)) { +#if UNITY_6000_0_OR_NEWER + rigidBody.linearVelocity = velocity; +#else rigidBody.velocity = velocity; +#endif } if (releaseBehavior.IsMaskSet(ReleaseBehaviorType.KeepAngularVelocity)) diff --git a/org.mixedrealitytoolkit.spatialmanipulation/Tests/Runtime/ObjectManipulatorTests.cs b/org.mixedrealitytoolkit.spatialmanipulation/Tests/Runtime/ObjectManipulatorTests.cs index 9a0ee83cd..4572f1b0d 100644 --- a/org.mixedrealitytoolkit.spatialmanipulation/Tests/Runtime/ObjectManipulatorTests.cs +++ b/org.mixedrealitytoolkit.spatialmanipulation/Tests/Runtime/ObjectManipulatorTests.cs @@ -987,7 +987,11 @@ public IEnumerator ObjectManipulatorRigidbodyCollision() yield return hand.Move(Vector3.forward * 3f); yield return RuntimeTestUtilities.WaitForFixedUpdates(); +#if UNITY_6000_0_OR_NEWER + Assert.AreNotEqual(Vector3.zero, backgroundRigidbody.linearVelocity); +#else Assert.AreNotEqual(Vector3.zero, backgroundRigidbody.velocity); +#endif Assert.AreEqual(1, collisionListener.CollisionCount); } @@ -1228,7 +1232,11 @@ public IEnumerator ObjectManipulatorNearThrow() // With simulated hand angular velocity would not be equal to 0, because of how simulation // moves hand when releasing the Pitch. Even though it doesn't directly follow from hand movement, there will always be some rotation. // Assert.NotZero(rigidBody.angularVelocity.magnitude, "ObjectManipulator should apply angular velocity to rigidBody upon release."); +#if UNITY_6000_0_OR_NEWER + Assert.AreEqual(hand.GetVelocity(), rigidBody.linearVelocity, "ObjectManipulator should apply hand velocity to rigidBody upon release."); +#else Assert.AreEqual(hand.GetVelocity(), rigidBody.velocity, "ObjectManipulator should apply hand velocity to rigidBody upon release."); +#endif // This is just for debugging purposes, so object's movement after release can be seen. yield return hand.MoveTo(initialHandPosition);