Skip to content

Commit 47877e7

Browse files
committed
fix: Improved the way the package detects if the platform can emit code at runtime
1 parent 7686dbe commit 47877e7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Runtime/Util/GeneratedUnityObjectCache.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
namespace GenericUnityObjects.Util
1+
#if (UNITY_EDITOR || UNITY_STANDALONE) && !ENABLE_IL2CPP && !NET_STANDARD_2_0
2+
#define CAN_EMIT
3+
#endif
4+
5+
namespace GenericUnityObjects.Util
26
{
37
using System;
48
using System.Collections.Generic;
@@ -8,7 +12,7 @@
812
using System.Reflection;
913
using UnityEngine.Assertions;
1014

11-
#if ! ENABLE_IL2CPP
15+
#if CAN_EMIT
1216
using System.Reflection.Emit;
1317
#endif
1418

@@ -30,7 +34,7 @@ private class CacheImplementation
3034
{
3135
public Type GetClass(Type genericTypeWithArgs)
3236
{
33-
#if ENABLE_IL2CPP
37+
#if !CAN_EMIT
3438
return null;
3539
}
3640
#else

0 commit comments

Comments
 (0)