Browse Source

Attempt a better conditional setup for Unity usage

Windows editor returns "enet" which is correct regardless of build setting, be it Windows/Mac/Linux. Need to test on macOS.
Matt Coburn 5 years ago
parent
commit
ad48fc66ef
1 changed files with 12 additions and 10 deletions
  1. 12 10
      Source/Managed/ENet.cs

+ 12 - 10
Source/Managed/ENet.cs

@@ -946,26 +946,28 @@ namespace ENet {
 		// This should address Unity usage and bug #66: Platform specific Enet / libenet
 		// This should address Unity usage and bug #66: Platform specific Enet / libenet
 		// https://github.com/SoftwareGuy/Ignorance/issues/66
 		// https://github.com/SoftwareGuy/Ignorance/issues/66
 #if UNITY_EDITOR
 #if UNITY_EDITOR
-		// We are inside the Unity Editor.
-	#if UNITY_EDITOR_OSX
+        // We are inside the Unity Editor.
+#if UNITY_EDITOR_OSX
 		// Unity Editor on macOS needs to use libenet.
 		// Unity Editor on macOS needs to use libenet.
 		private const string nativeLibrary = "libenet";
 		private const string nativeLibrary = "libenet";
-	#else
-		// TODO: Check if Linux requires 'libenet' too. (Apparently not?)
-		private const string nativeLibrary = "enet";
-	#endif
 #else
 #else
+        // TODO: Check if Linux requires 'libenet' too. (Apparently not?)
+        private const string nativeLibrary = "enet";
+#endif
+#endif
+
+#if !UNITY_EDITOR
 		// We're not inside the Unity Editor.
 		// We're not inside the Unity Editor.
-	#if __APPLE__ && !(__IOS__ || UNITY_IOS)
+#if __APPLE__ && !(__IOS__ || UNITY_IOS)
 		// Use libenet on macOS.
 		// Use libenet on macOS.
 		private const string nativeLibrary = "libenet";
 		private const string nativeLibrary = "libenet";
-	#elif __IOS__ || UNITY_IOS
+#elif __IOS__ || UNITY_IOS
         // We're building for a certain mobile fruity OS.
         // We're building for a certain mobile fruity OS.
 		private const string nativeLibrary = "__Internal";
 		private const string nativeLibrary = "__Internal";
-	#else
+#else
         // Assume everything else, Windows et al... TODO: Linux check		
         // Assume everything else, Windows et al... TODO: Linux check		
         private const string nativeLibrary = "enet";
         private const string nativeLibrary = "enet";
-	#endif	
+#endif
 #endif
 #endif
 
 
 		[DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
 		[DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]