From 4b77a524839fa2f3b5796f3c62194912b85a22d9 Mon Sep 17 00:00:00 2001 From: Nan Date: Fri, 28 Jul 2023 10:54:49 +0900 Subject: [PATCH] Added compatibility with Unity 2017+ --- src/MoonSharp.Interpreter/Loaders/UnityAssetsScriptLoader.cs | 4 ++-- src/MoonSharp.Interpreter/Platforms/PlatformAutoDetector.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MoonSharp.Interpreter/Loaders/UnityAssetsScriptLoader.cs b/src/MoonSharp.Interpreter/Loaders/UnityAssetsScriptLoader.cs index 7db23081..a4747f98 100755 --- a/src/MoonSharp.Interpreter/Loaders/UnityAssetsScriptLoader.cs +++ b/src/MoonSharp.Interpreter/Loaders/UnityAssetsScriptLoader.cs @@ -31,7 +31,7 @@ public class UnityAssetsScriptLoader : ScriptLoaderBase public UnityAssetsScriptLoader(string assetsPath = null) { assetsPath = assetsPath ?? DEFAULT_PATH; -#if UNITY_5 +#if UNITY_5 || UNITY_2017_1_OR_NEWER LoadResourcesUnityNative(assetsPath); #else LoadResourcesWithReflection(assetsPath); @@ -48,7 +48,7 @@ public UnityAssetsScriptLoader(Dictionary scriptToCodeMap) m_Resources = scriptToCodeMap; } -#if UNITY_5 +#if UNITY_5 || UNITY_2017_1_OR_NEWER void LoadResourcesUnityNative(string assetsPath) { try diff --git a/src/MoonSharp.Interpreter/Platforms/PlatformAutoDetector.cs b/src/MoonSharp.Interpreter/Platforms/PlatformAutoDetector.cs index b1765517..c8f62023 100755 --- a/src/MoonSharp.Interpreter/Platforms/PlatformAutoDetector.cs +++ b/src/MoonSharp.Interpreter/Platforms/PlatformAutoDetector.cs @@ -84,7 +84,7 @@ private static void AutoDetectPlatformFlags() IsUnityNative = true; #endif #else -#if UNITY_5 +#if UNITY_5 || UNITY_2017_1_OR_NEWER IsRunningOnUnity = true; IsUnityNative = true;