Skip to content

Commit 15ee6b1

Browse files
committed
Don’t use System.Expressions w/ IL2CPP
See #4
1 parent 689cb2d commit 15ee6b1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

UnityAsync/Assets/UnityAsync/Extensions.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,22 @@ namespace UnityAsync
1111
{
1212
public static class Extensions
1313
{
14+
#if !ENABLE_IL2CPP
15+
1416
static readonly Func<Object, IntPtr> ObjectPtrGetter;
1517

16-
static Extensions()
17-
{
18-
ReflectionUtility.GenerateFieldGetter("m_CachedPtr", out ObjectPtrGetter);
19-
}
18+
static Extensions() => ReflectionUtility.GenerateFieldGetter("m_CachedPtr", out ObjectPtrGetter);
2019

2120
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2221
internal static bool IsAlive(this Object o) => ObjectPtrGetter(o) != IntPtr.Zero;
2322

23+
#else
24+
25+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
26+
internal static bool IsAlive(this Object o) => o != null;
27+
28+
#endif
29+
2430
/// <summary>
2531
/// Link the <see cref="UnityAsync.IAwaitInstruction"/>'s lifespan to a <see cref="UnityEngine.Object"/> and
2632
/// configure the type of update cycle it should be evaluated on.

0 commit comments

Comments
 (0)