File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
UnityAsync/Assets/UnityAsync Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments