diff --git a/Assets/Toolkit/Toolkit/Scripts/AotHelper.cs b/Assets/Toolkit/Toolkit/Scripts/AotHelper.cs new file mode 100644 index 0000000..7c64045 --- /dev/null +++ b/Assets/Toolkit/Toolkit/Scripts/AotHelper.cs @@ -0,0 +1,26 @@ +using System; + +namespace Ca2d.Toolkit +{ + public static class AotHelper + { + private static DateTime alwayasFalseSource = DateTime.UtcNow; + + /// + /// Utility to provide a must be false option for Ahead-of-time compiler. + /// + /// False + public static bool AlwaysFalseProvider() + { + return alwayasFalseSource.Year < 0; + } + + /// + /// Create ahead-of-time info for compile while you can never successfully call given action at runtime. + /// + public static void Ensure(Action call) + { + if (AlwaysFalseProvider()) call?.Invoke(); + } + } +} \ No newline at end of file diff --git a/Assets/Toolkit/Toolkit/Scripts/AotHelper.cs.meta b/Assets/Toolkit/Toolkit/Scripts/AotHelper.cs.meta new file mode 100644 index 0000000..e8b19b9 --- /dev/null +++ b/Assets/Toolkit/Toolkit/Scripts/AotHelper.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 880dab2141004ae2a8c6793e186f211d +timeCreated: 1719155856 \ No newline at end of file