perf(Extensions): Add shim for transform.GetPositionAndRotation (#3755)

Doesn't exist in unity versions 2021.2 or earlier
This commit is contained in:
Robin Rolf 2024-01-29 18:49:31 +01:00 committed by MrGadget
parent b403405c85
commit e4e23afd9c

View File

@ -2,6 +2,7 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;
namespace Mirror
{
@ -98,5 +99,14 @@ public static void Clear<T>(this ConcurrentQueue<T> source)
}
}
#endif
#if !UNITY_2021_3_OR_NEWER
// Unity 2021.2 and earlier don't have transform.GetPositionAndRotation which we use for performance in some places
public static void GetPositionAndRotation(this Transform transform, out Vector3 position, out Quaternion rotation)
{
position = transform.position;
rotation = transform.rotation;
}
#endif
}
}