Skip to content

Commit df128a7

Browse files
committed
fix running in Editor with Android/iOS platform selected
1 parent cd795f7 commit df128a7

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

Runtime/LLMUnitySetup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public static async Task AndroidExtractFile(string assetName, bool overwrite = f
318318
{
319319
if (!androidExtractTasks.TryGetValue(assetName, out extractionTask))
320320
{
321-
#if UNITY_ANDROID
321+
#if !UNITY_EDITOR && UNITY_ANDROID
322322
extractionTask = AndroidExtractFileOnce(assetName, overwrite, log, chunkSize);
323323
#else
324324
extractionTask = Task.CompletedTask;

Runtime/LlamaLib/LibraryLoader.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static IntPtr LoadLibrary(string libraryPath)
4040
if (string.IsNullOrEmpty(libraryPath))
4141
throw new ArgumentNullException(nameof(libraryPath));
4242

43-
#if (ANDROID || IOS || VISIONOS) || (UNITY_ANDROID || UNITY_IOS || UNITY_VISIONOS)
43+
#if (ANDROID || IOS || VISIONOS) || (!UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS || UNITY_VISIONOS))
4444
return Mobile.dlopen(libraryPath);
4545
#else
4646
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
@@ -64,7 +64,7 @@ public static IntPtr GetSymbol(IntPtr library, string symbolName)
6464
if (string.IsNullOrEmpty(symbolName))
6565
throw new ArgumentNullException(nameof(symbolName));
6666

67-
#if (ANDROID || IOS || VISIONOS) || (UNITY_ANDROID || UNITY_IOS || UNITY_VISIONOS)
67+
#if (ANDROID || IOS || VISIONOS) || (!UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS || UNITY_VISIONOS))
6868
return Mobile.dlsym(library, symbolName);
6969
#else
7070
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
@@ -86,7 +86,7 @@ public static void FreeLibrary(IntPtr library)
8686
if (library == IntPtr.Zero)
8787
return;
8888

89-
#if (ANDROID || IOS || VISIONOS) || (UNITY_ANDROID || UNITY_IOS || UNITY_VISIONOS)
89+
#if (ANDROID || IOS || VISIONOS) || (!UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS || UNITY_VISIONOS))
9090
Mobile.dlclose(library);
9191
#else
9292
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
@@ -192,7 +192,7 @@ private static class Mobile
192192
{
193193
public static IntPtr dlopen(string path) => dlopen(path, 1);
194194

195-
#if (ANDROID || IOS || VISIONOS) || (UNITY_ANDROID || UNITY_IOS || UNITY_VISIONOS)
195+
#if (ANDROID || IOS || VISIONOS) || (!UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS || UNITY_VISIONOS))
196196
[DllImport("__Internal")]
197197
public static extern IntPtr dlopen(string filename, int flags);
198198

0 commit comments

Comments
 (0)