Skip to content

Commit

Permalink
Use UnsafeUtility.As in Unity 2020 or newer.
Browse files Browse the repository at this point in the history
  • Loading branch information
timcassell committed Aug 23, 2023
1 parent fa277c2 commit 1572b78
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Package/Core/InternalShared/HelperFunctionsInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,11 @@ internal static int BuildHashCode(object _ref, int hashcode1, int hashcode2, int
[MethodImpl(InlineOption)]
internal static T UnsafeAs<T>(this object o) where T : class
{
#if NET5_0_OR_GREATER && !PROMISE_DEBUG && !PROTO_PROMISE_DEVELOPER_MODE
#if PROMISE_DEBUG || PROTO_PROMISE_DEVELOPER_MODE
return (T) o;
#elif UNITY_2020_1_OR_NEWER
return Unity.Collections.LowLevel.Unsafe.UnsafeUtility.As<T>(o);
#elif NET5_0_OR_GREATER
return Unsafe.As<T>(o);
#else
return (T) o;
Expand Down

0 comments on commit 1572b78

Please sign in to comment.