From 6dadc9617761a6640b4e698b77b60c4ad0a794a2 Mon Sep 17 00:00:00 2001 From: Antonis Makropoulos Date: Wed, 28 Jan 2026 15:47:20 +0200 Subject: [PATCH] fix running in Editor with Android/iOS platform selected --- Runtime/LLMUnitySetup.cs | 2 +- Runtime/LlamaLib/LibraryLoader.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Runtime/LLMUnitySetup.cs b/Runtime/LLMUnitySetup.cs index 2d8ccb9f..543f417d 100644 --- a/Runtime/LLMUnitySetup.cs +++ b/Runtime/LLMUnitySetup.cs @@ -318,7 +318,7 @@ public static async Task AndroidExtractFile(string assetName, bool overwrite = f { if (!androidExtractTasks.TryGetValue(assetName, out extractionTask)) { -#if UNITY_ANDROID +#if !UNITY_EDITOR && UNITY_ANDROID extractionTask = AndroidExtractFileOnce(assetName, overwrite, log, chunkSize); #else extractionTask = Task.CompletedTask; diff --git a/Runtime/LlamaLib/LibraryLoader.cs b/Runtime/LlamaLib/LibraryLoader.cs index 6893cfde..aae01bed 100644 --- a/Runtime/LlamaLib/LibraryLoader.cs +++ b/Runtime/LlamaLib/LibraryLoader.cs @@ -40,7 +40,7 @@ public static IntPtr LoadLibrary(string libraryPath) if (string.IsNullOrEmpty(libraryPath)) throw new ArgumentNullException(nameof(libraryPath)); -#if (ANDROID || IOS || VISIONOS) || (UNITY_ANDROID || UNITY_IOS || UNITY_VISIONOS) +#if (ANDROID || IOS || VISIONOS) || (!UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS || UNITY_VISIONOS)) return Mobile.dlopen(libraryPath); #else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) @@ -64,7 +64,7 @@ public static IntPtr GetSymbol(IntPtr library, string symbolName) if (string.IsNullOrEmpty(symbolName)) throw new ArgumentNullException(nameof(symbolName)); -#if (ANDROID || IOS || VISIONOS) || (UNITY_ANDROID || UNITY_IOS || UNITY_VISIONOS) +#if (ANDROID || IOS || VISIONOS) || (!UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS || UNITY_VISIONOS)) return Mobile.dlsym(library, symbolName); #else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) @@ -86,7 +86,7 @@ public static void FreeLibrary(IntPtr library) if (library == IntPtr.Zero) return; -#if (ANDROID || IOS || VISIONOS) || (UNITY_ANDROID || UNITY_IOS || UNITY_VISIONOS) +#if (ANDROID || IOS || VISIONOS) || (!UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS || UNITY_VISIONOS)) Mobile.dlclose(library); #else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) @@ -192,7 +192,7 @@ private static class Mobile { public static IntPtr dlopen(string path) => dlopen(path, 1); -#if (ANDROID || IOS || VISIONOS) || (UNITY_ANDROID || UNITY_IOS || UNITY_VISIONOS) +#if (ANDROID || IOS || VISIONOS) || (!UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS || UNITY_VISIONOS)) [DllImport("__Internal")] public static extern IntPtr dlopen(string filename, int flags);