mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 19:10:32 +00:00
perf(Extensions): Add shim for transform.GetPositionAndRotation (#3755)
Doesn't exist in unity versions 2021.2 or earlier
This commit is contained in:
parent
b403405c85
commit
e4e23afd9c
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user