Esempio n. 1
0
 void _SetCompatibleWithPlatform(string platformName, bool enable)
 {
     if (_pluginImporter != null)
     {
         if (_pluginImporter.GetCompatibleWithPlatform(platformName) != enable)
         {
             _pluginImporter.SetCompatibleWithPlatform(platformName, enable);
             _isWritten = true;
         }
     }
 }
Esempio n. 2
0
 private static void SetPluginCompatibleIdp(BuildTarget target, string path, bool enable)
 {
     //			if (File.Exists (path) == true || Directory.Exists (path) == true) {
     //				FileAttributes attr = File.GetAttributes (path);
     //				string[] pathSplit = path.Split ('/');
     //				string name = pathSplit [pathSplit.Length - 1];
     //				if ((attr & FileAttributes.Directory) == FileAttributes.Directory && name.Contains (".") == false) {
     //					Debug.LogError ("directory : " + path);
     //					string[] directoryPaths = Directory.GetDirectories (path, "*", SearchOption.TopDirectoryOnly);
     //					foreach (string directoryPath in directoryPaths) {
     //						SetPluginCompatibleIdp (target, directoryPath, enable);
     //					}
     //				} else {
     //					Debug.LogError ("file : " + path);
     if (File.Exists(path) == true || Directory.Exists(path) == true)
     {
         PluginImporter pluginImporter = PluginImporter.GetAtPath(path) as PluginImporter;
         if (pluginImporter != null)
         {
             if (pluginImporter.GetCompatibleWithAnyPlatform() == true)
             {
                 pluginImporter.SetCompatibleWithAnyPlatform(false);
             }
             if (pluginImporter.GetCompatibleWithPlatform(target) != enable)
             {
                 pluginImporter.SetCompatibleWithPlatform(target, enable);
                 pluginImporter.SaveAndReimport();
             }
         }
     }
     //				}
     //			}
 }
 private static void SetCompatibleWithPlatform(PluginImporter pluginImporter, BuildTarget buildTarget, bool enable)
 {
     if (pluginImporter.GetCompatibleWithPlatform(buildTarget) != enable)
     {
         pluginImporter.SetCompatibleWithPlatform(buildTarget, enable);
         mHasAtLeastOneLibraryBeenModified = true;
     }
 }
Esempio n. 4
0
        private FixProblemInstruction checkAndGetInstruction(string relativePath, platforms platform)
        {
            EnablePluginForPlatform instr = null;
            PluginImporter          imp   = AssetImporter.GetAtPath(relativePath) as PluginImporter;

            if (imp == null)
            {
                return(instr);
            }
            bool isChecked = false;

            switch (platform)
            {
            case platforms.any:
                isChecked = imp.GetCompatibleWithAnyPlatform();
                break;

            case platforms.editor:
                isChecked = imp.GetCompatibleWithEditor();
                break;

            case platforms.android:
                isChecked = imp.GetCompatibleWithPlatform(BuildTarget.Android);
                break;

            case platforms.ios:
                isChecked = imp.GetCompatibleWithPlatform(BuildTarget.iOS);
                break;
            }

            if (!isChecked)
            {
                string desc = "Plugin " + relativePath + " should be enabled for platform: " + platform.ToString() +
                              ".\n";
                if (relativePath.Contains(AppodealUnityUtils.combinePaths("Assets", "Plugins", "Android")))
                {
                    desc +=
                        "If you wan't to exclude this network from your game, don't forget to add Appodeal.disableNetwork(networkname) before initialization.";
                }
                instr = new EnablePluginForPlatform(desc, true, relativePath, platform);
            }

            return(instr);
        }
    static bool SetCompatibleWithPlatform(PluginImporter plugin, BuildTarget platform, bool enable)
    {
        if (plugin.GetCompatibleWithPlatform(platform) == enable)
        {
            return(false);
        }

        plugin.SetCompatibleWithPlatform(platform, enable);
        return(true);
    }
Esempio n. 6
0
        /// <summary>
        /// Returns true if the plugin importer already has the correct settings, otherwise returns false. If
        /// false is returned, the plugin settings should be reset to their expected values.
        /// </summary>
        /// <param name="pluginImporter"></param>
        /// <param name="isCompatibleWithAnyPlatform"></param>
        /// <param name="isCompatibleWithEditor"></param>
        /// <param name="editorPlatform"></param>
        /// <param name="allowedRuntimePlatforms"></param>
        /// <returns></returns>
        private static bool HasCorrectImportSettings(
            PluginImporter pluginImporter,
            bool isCompatibleWithAnyPlatform,
            bool isCompatibleWithEditor,
            EditorOS editorPlatform,
            params BuildTarget[] allowedRuntimePlatforms)
        {
            // Return false if our platform compatibility doesn't match
            if (pluginImporter.GetCompatibleWithAnyPlatform() != isCompatibleWithAnyPlatform)
            {
                return(false);
            }

            // Return false if our editor compatibility doesn't match
            if (pluginImporter.GetCompatibleWithEditor() != isCompatibleWithEditor)
            {
                return(false);
            }

            // If the plugin is compatible with the editor and not set to the proper platform or to the proper
            // CPU level, return false.
            if (pluginImporter.GetCompatibleWithEditor() && isCompatibleWithEditor)
            {
                var editorPlatformValue = pluginImporter.GetEditorData(OS_KEY);
                var editorOS            = (EditorOS)Enum.Parse(typeof(EditorOS), editorPlatformValue);
                if (editorOS != editorPlatform)
                {
                    return(false);
                }

                if (pluginImporter.GetEditorData(CPU_KEY) != CPU_VALUE)
                {
                    return(false);
                }
            }

            // Check compatibility with each platform and verify that we have correct setting for each.
            foreach (var buildTarget in ALL_BUILD_TARGETS)
            {
                var shouldBeCompatible = allowedRuntimePlatforms.Contains(buildTarget);
                var isCompatible       = pluginImporter.GetCompatibleWithPlatform(buildTarget);

                if (shouldBeCompatible && !isCompatible)
                {
                    return(false);
                }
                else if (!shouldBeCompatible && isCompatible)
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 7
0
    static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
                #if UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_5_5 || UNITY_5_4
        foreach (string importedAsset in importedAssets)
        {
            if (importedAsset.Equals(importedAssets[importedAssets.Length - 1]))
            {
                if (Directory.Exists(Utils.FixSlashesInPath("Assets/Plugins/Android/appodeal/assets")) && !Directory.Exists(Utils.FixSlashesInPath("Assets/Plugins/Android/assets")))
                {
                    if (EditorUtility.DisplayDialog("Appodeal Unity", "We have detected that you're using Unity" + Application.unityVersion + " and it can't compile android assets from library folder so Assets/Plugins/Android/appodeal/assets folder should be moved into Android folder.", "Move it for me", "Leave it there"))
                    {
                        Directory.Move(Utils.FixSlashesInPath("Assets/Plugins/Android/appodeal/assets"), Utils.FixSlashesInPath("Assets/Plugins/Android/assets"));
                        reimportFolder(Utils.FixSlashesInPath("Assets/Plugins/Android/assets"));
                        reimportFolder(Utils.FixSlashesInPath("Assets/Plugins/Android/appodeal"));
                    }
                }
            }
        }
                #endif

                #if UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7
        if (File.Exists(Utils.FixSlashesInPath("Assets/Appodeal/SampleAndroidManifest.xml")) && !File.Exists(Utils.FixSlashesInPath("Assets/Plugins/Android/AndroidManifest.xml")))
        {
            FileUtil.CopyFileOrDirectory(Utils.FixSlashesInPath("Assets/Appodeal/SampleAndroidManifest.xml"), Utils.FixSlashesInPath("Assets/Plugins/Android/AndroidManifest.xml"));
        }
                #endif

                #if UNITY_5_5 || UNITY_5_4
        foreach (string plugin in Plugins)
        {
            string fullpath = Utils.FixSlashesInPath("Assets/Plugins/Android/" + plugin);
            if (File.Exists(fullpath))
            {
                PluginImporter pluginImporter = AssetImporter.GetAtPath(fullpath) as PluginImporter;
                if (!pluginImporter.GetCompatibleWithPlatform(BuildTarget.Android))
                {
                    pluginImporter.SetCompatibleWithPlatform(BuildTarget.Android, true);
                }
            }
        }

        string path = Utils.FixSlashesInPath("Assets/Plugins/Ionic.Zip.Unity.dll");
        if (File.Exists(path))
        {
            PluginImporter ionicPluginImporter = AssetImporter.GetAtPath(path) as PluginImporter;
            if (!ionicPluginImporter.GetCompatibleWithEditor())
            {
                ionicPluginImporter.SetCompatibleWithEditor(true);
            }
        }
                #endif
    }
        internal bool UpdateCompatibleWithPlatform(PluginImporter pluginImporter)
        {
            if (CompatiblePlatform != 0 && !pluginImporter.GetCompatibleWithPlatform(CompatiblePlatform))
            {
                pluginImporter.SetCompatibleWithPlatform(CompatiblePlatform, true);
                if (!string.IsNullOrEmpty(CPU))
                {
                    pluginImporter.SetPlatformData(CompatiblePlatform, "CPU", CPU);
                }

                return(true);
            }

            return(false);
        }
Esempio n. 9
0
        private void CheckWSADllPlatforms()
        {
#if !UNITY_4 && !UNITY_5_0 && !UNITY_5_1 && !UNITY_5_2
            string pluginPath = "Assets/Plugins/UTNotifications.dll";

            PluginImporter pluginImporter = ((PluginImporter)AssetImporter.GetAtPath(pluginPath));
            if (pluginImporter.GetCompatibleWithAnyPlatform() || pluginImporter.GetCompatibleWithPlatform(BuildTarget.WSAPlayer))
            {
                pluginImporter.SetCompatibleWithAnyPlatform(false);
                pluginImporter.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, false);
                pluginImporter.SetCompatibleWithEditor(true);
                pluginImporter.SaveAndReimport();
                AssetDatabase.ImportAsset(pluginPath);
            }
#endif
        }
Esempio n. 10
0
    static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
                #if UNITY_4 && UNITY_IPHONE
        if (PlayerSettings.apiCompatibilityLevel.Equals(ApiCompatibilityLevel.NET_2_0_Subset))
        {
            if (EditorUtility.DisplayDialog("Appodeal Unity", "We have detected that you're using subset API compatibility level: " + PlayerSettings.apiCompatibilityLevel + " you should change it to NET_2_0 to be able using Ionic.ZIP.dll.", "Change it for me", "I'll do it"))
            {
                PlayerSettings.apiCompatibilityLevel = ApiCompatibilityLevel.NET_2_0;
            }
        }
                #endif

                #if UNITY_4
        if (File.Exists(Utils.FixSlashesInPath("Assets/Appodeal/SampleAndroidManifest.xml")) && !File.Exists(Utils.FixSlashesInPath("Assets/Plugins/Android/AndroidManifest.xml")) && moveManifest)
        {
            if (EditorUtility.DisplayDialog("Appodeal Unity", "We have detected that you have no AndroidManifest.xml inside Android folder, it should override Unity's settings to fix not clickable ads", "Place template for me", "Don't do that!"))
            {
                FileUtil.CopyFileOrDirectory(Utils.FixSlashesInPath("Assets/Appodeal/SampleAndroidManifest.xml"), Utils.FixSlashesInPath("Assets/Plugins/Android/AndroidManifest.xml"));
            }
        }
                #endif

                #if UNITY_5
        foreach (string plugin in Plugins)
        {
            string fullpath = Utils.FixSlashesInPath("Assets/Plugins/Android/" + plugin);
            if (File.Exists(fullpath))
            {
                PluginImporter pluginImporter = AssetImporter.GetAtPath(fullpath) as PluginImporter;
                if (!pluginImporter.GetCompatibleWithPlatform(BuildTarget.Android))
                {
                    pluginImporter.SetCompatibleWithPlatform(BuildTarget.Android, true);
                }
            }
        }

        string path = Utils.FixSlashesInPath("Assets/Plugins/Ionic.Zip.Unity.dll");
        if (File.Exists(path))
        {
            PluginImporter ionicPluginImporter = AssetImporter.GetAtPath(path) as PluginImporter;
            if (!ionicPluginImporter.GetCompatibleWithEditor())
            {
                ionicPluginImporter.SetCompatibleWithEditor(true);
            }
        }
                #endif
    }
Esempio n. 11
0
        public static void SwitchCompatibleWithPlatform(PluginImporter plugin, bool value)
        {
            if (value && plugin.GetCompatibleWithPlatform(BuildTarget.StandaloneWindows64) != value)
            {
                Debug.Log("Platform " + EditorUserBuildSettings.activeBuildTarget + ". Nuitrack dll switched to " + plugin.assetPath);
            }

            plugin.SetCompatibleWithAnyPlatform(false);
            plugin.SetCompatibleWithPlatform(BuildTarget.iOS, value);
            plugin.SetCompatibleWithPlatform(BuildTarget.Android, value);
            //plugin.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, value);
            plugin.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, value);
            plugin.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, value);
            plugin.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, value);
            plugin.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, value);
            plugin.SetCompatibleWithEditor(value);
        }
Esempio n. 12
0
        private static void SelectBinaries(Platform platform, BuildTarget target, Platform.BinaryType binaryType)
        {
            string message = string.Format("FMOD: Selected binaries for platform {0}{1}:", target,
                                           (binaryType == Platform.BinaryType.Logging) ? " (development build)" : string.Empty);

            Instance.binaryCompatibilitiesBeforeBuild = new Dictionary <string, bool>();

            HashSet <string> enabledPaths = new HashSet <string>();

            foreach (string path in platform.GetBinaryAssetPaths(target, binaryType | Platform.BinaryType.Optional))
            {
                PluginImporter importer = AssetImporter.GetAtPath(path) as PluginImporter;

                if (importer is PluginImporter)
                {
                    Instance.binaryCompatibilitiesBeforeBuild.Add(path, importer.GetCompatibleWithPlatform(target));

                    importer.SetCompatibleWithPlatform(target, true);

                    enabledPaths.Add(path);

                    message += string.Format("\n- Enabled {0}", path);
                }
            }

            foreach (string path in platform.GetBinaryAssetPaths(target, Platform.BinaryType.All))
            {
                if (!enabledPaths.Contains(path))
                {
                    PluginImporter importer = AssetImporter.GetAtPath(path) as PluginImporter;

                    if (importer is PluginImporter)
                    {
                        Instance.binaryCompatibilitiesBeforeBuild.Add(path, importer.GetCompatibleWithPlatform(target));

                        importer.SetCompatibleWithPlatform(target, false);

                        message += string.Format("\n- Disabled {0}", path);
                    }
                }
            }

            RuntimeUtils.DebugLog(message);
        }
Esempio n. 13
0
        private static bool HasCompatibility(string pathToDLL, BuildTarget[] supportedBuildTargets, bool isCompatibleWithEditor)
        {
            PluginImporter pluginImporter = (PluginImporter)AssetImporter.GetAtPath(pathToDLL);

            // check if any platform is enabled
            if (pluginImporter.GetCompatibleWithAnyPlatform())
            {
                return(false);
            }

            // check if compatible with editor if that is desired
            if (pluginImporter.GetCompatibleWithEditor() != isCompatibleWithEditor)
            {
                return(false);
            }

            // check for each build target if compatible when desired
            foreach (BuildTarget buildTarget in Enum.GetValues(typeof(BuildTarget)))
            {
                if (IsBuildTargetObsolete(buildTarget) || buildTarget == BuildTarget.NoTarget)
                {
                    continue;;
                }

                bool isCompatible = pluginImporter.GetCompatibleWithPlatform(buildTarget);

                if (supportedBuildTargets.Contains(buildTarget))
                {
                    if (!isCompatible)
                    {
                        return(false);
                    }
                }
                else
                {
                    if (isCompatible)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Esempio n. 14
0
        public bool IsAndroidUniversalEnabled()
        {
            string path = "";

            if (Plugins.TryGetValue(PluginPlatform.AndroidUniversal, out path))
            {
                if (File.Exists(path))
                {
                    string basePath = GetCurrentProjectPath();
                    string relPath  = path.Substring(basePath.Length + 1);

                    PluginImporter pi = PluginImporter.GetAtPath(relPath) as PluginImporter;
                    if (pi != null)
                    {
                        return(pi.GetCompatibleWithPlatform(BuildTarget.Android));
                    }
                }
            }

            return(false);
        }
Esempio n. 15
0
        public bool IsWin64Enabled()
        {
            string path = "";

            if (Plugins.TryGetValue(PluginPlatform.Win64, out path))
            {
                if (File.Exists(path))
                {
                    string basePath = GetCurrentProjectPath();
                    string relPath  = path.Substring(basePath.Length + 1);

                    PluginImporter pi = PluginImporter.GetAtPath(relPath) as PluginImporter;
                    if (pi != null)
                    {
                        return(pi.GetCompatibleWithPlatform(BuildTarget.StandaloneWindows64) && pi.GetCompatibleWithEditor());
                    }
                }
            }

            return(false);
        }
Esempio n. 16
0
    static void SetDLLPlatforms(string dllName, bool active)
    {
        string[] assetGuids = AssetDatabase.FindAssets(dllName);

        foreach (string guid in assetGuids)
        {
            string dllPath = AssetDatabase.GUIDToAssetPath(guid);
            if (string.IsNullOrEmpty(dllPath) || dllPath.ToLower().EndsWith(".dll") == false)
            {
                return;
            }

            PluginImporter importer = AssetImporter.GetAtPath(dllPath) as PluginImporter;

            bool allCorrect = true;
            if (importer.GetCompatibleWithAnyPlatform() != active)
            {
                allCorrect = false;
            }
            else
            {
                if (importer.GetCompatibleWithAnyPlatform())
                {
                    if (importer.GetExcludeEditorFromAnyPlatform() != !active ||
                        importer.GetExcludeFromAnyPlatform(BuildTarget.StandaloneWindows) != !active)
                    {
                        allCorrect = false;
                    }
                }
                else
                {
                    if (importer.GetCompatibleWithEditor() != active ||
                        importer.GetCompatibleWithPlatform(BuildTarget.StandaloneWindows) != active)
                    {
                        allCorrect = false;
                    }
                }
            }

            if (allCorrect == false)
            {
                if (active)
                {
                    importer.SetCompatibleWithAnyPlatform(true);
                    importer.SetExcludeEditorFromAnyPlatform(false);
                    importer.SetExcludeFromAnyPlatform(BuildTarget.Android, false);
                    importer.SetExcludeFromAnyPlatform(BuildTarget.StandaloneWindows, false);
                    importer.SetExcludeFromAnyPlatform(BuildTarget.StandaloneWindows64, false);
                    importer.SetExcludeFromAnyPlatform(BuildTarget.StandaloneLinux64, false);
                }
                else
                {
                    importer.SetCompatibleWithAnyPlatform(false);
                    importer.SetCompatibleWithEditor(false);
                    importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
                }
                importer.SaveAndReimport();
            }
        }
    }
Esempio n. 17
0
 static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
 {
     // Fix for wrong tvOS platform imports
     {
         PluginImporter importer = AssetImporter.GetAtPath("Assets/Plugins/tvOS/GameAnalyticsTVOS.h") as PluginImporter;
         if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.tvOS) || importer.GetCompatibleWithPlatform(BuildTarget.iOS)))
         {
             importer.SetCompatibleWithAnyPlatform(false);
             importer.SetCompatibleWithEditor(false);
             importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
             importer.SetCompatibleWithPlatform(BuildTarget.WebPlayer, false);
             importer.SetCompatibleWithPlatform(BuildTarget.WebPlayerStreamed, false);
             importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
             importer.SetCompatibleWithPlatform(BuildTarget.tvOS, true);
             importer.SaveAndReimport();
         }
     }
     {
         PluginImporter importer = AssetImporter.GetAtPath("Assets/Plugins/tvOS/GameAnalyticsTVOSUnity.m") as PluginImporter;
         if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.tvOS) || importer.GetCompatibleWithPlatform(BuildTarget.iOS)))
         {
             importer.SetCompatibleWithAnyPlatform(false);
             importer.SetCompatibleWithEditor(false);
             importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
             importer.SetCompatibleWithPlatform(BuildTarget.WebPlayer, false);
             importer.SetCompatibleWithPlatform(BuildTarget.WebPlayerStreamed, false);
             importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
             importer.SetCompatibleWithPlatform(BuildTarget.tvOS, true);
             importer.SaveAndReimport();
         }
     }
     {
         PluginImporter importer = AssetImporter.GetAtPath("Assets/Plugins/tvOS/libGameAnalyticsTVOS.a") as PluginImporter;
         if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.tvOS) || importer.GetCompatibleWithPlatform(BuildTarget.iOS)))
         {
             importer.SetCompatibleWithAnyPlatform(false);
             importer.SetCompatibleWithEditor(false);
             importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
             importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
             importer.SetCompatibleWithPlatform(BuildTarget.WebPlayer, false);
             importer.SetCompatibleWithPlatform(BuildTarget.WebPlayerStreamed, false);
             importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
             importer.SetCompatibleWithPlatform(BuildTarget.tvOS, true);
             importer.SaveAndReimport();
         }
     }
 }
Esempio n. 18
0
        static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
        {
            #region iOS and tvOS
            {
                PluginImporter importer = AssetImporter.GetAtPath("Assets/GameAnalytics/Plugins/tvOS/GameAnalyticsTVOS.h") as PluginImporter;
                if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.tvOS) || importer.GetCompatibleWithPlatform(BuildTarget.iOS)))
                {
                    importer.SetCompatibleWithAnyPlatform(false);
                    importer.SetCompatibleWithEditor(false);
                    importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, false);
#if UNITY_2017_3_OR_NEWER
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
#endif
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.tvOS, true);
                    importer.SetCompatibleWithPlatform(BuildTarget.WebGL, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, false);
                    importer.SaveAndReimport();
                }
            }
            {
                PluginImporter importer = AssetImporter.GetAtPath("Assets/GameAnalytics/Plugins/tvOS/GameAnalyticsTVOSUnity.m") as PluginImporter;
                if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.tvOS) || importer.GetCompatibleWithPlatform(BuildTarget.iOS)))
                {
                    importer.SetCompatibleWithAnyPlatform(false);
                    importer.SetCompatibleWithEditor(false);
                    importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, false);
#if UNITY_2017_3_OR_NEWER
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
#endif
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.tvOS, true);
                    importer.SetCompatibleWithPlatform(BuildTarget.WebGL, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, false);
                    importer.SaveAndReimport();
                }
            }
            {
                PluginImporter importer = AssetImporter.GetAtPath("Assets/GameAnalytics/Plugins/tvOS/libGameAnalyticsTVOS.a") as PluginImporter;
                if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.tvOS) || importer.GetCompatibleWithPlatform(BuildTarget.iOS)))
                {
                    importer.SetCompatibleWithAnyPlatform(false);
                    importer.SetCompatibleWithEditor(false);
                    importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, false);
#if UNITY_2017_3_OR_NEWER
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
#endif
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.tvOS, true);
                    importer.SetCompatibleWithPlatform(BuildTarget.WebGL, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, false);
                    importer.SaveAndReimport();
                }
            }
            #endregion // iOS and tvOS
            #region General
            {
                PluginImporter importer = AssetImporter.GetAtPath("Assets/GameAnalytics/Plugins/GameAnalytics.dll") as PluginImporter;
                if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.StandaloneLinux) ||
                                         !importer.GetCompatibleWithPlatform(BuildTarget.StandaloneLinux64) ||
                                         !importer.GetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal) ||
#if UNITY_2017_3_OR_NEWER
                                         !importer.GetCompatibleWithPlatform(BuildTarget.StandaloneOSX) ||
#else
                                         !importer.GetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel) ||
                                         !importer.GetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64) ||
                                         !importer.GetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal) ||
#endif
                                         !importer.GetCompatibleWithPlatform(BuildTarget.StandaloneWindows) ||
                                         !importer.GetCompatibleWithPlatform(BuildTarget.StandaloneWindows64) ||
                                         !importer.GetCompatibleWithPlatform(BuildTarget.WSAPlayer) ||
                                         !importer.GetPlatformData(BuildTarget.WSAPlayer, "SDK").Equals("UWP") ||
                                         !importer.GetPlatformData(BuildTarget.WSAPlayer, "ScriptingBackend").Equals("Il2Cpp")))
                {
                    importer.SetCompatibleWithAnyPlatform(false);
                    importer.SetCompatibleWithEditor(false);
                    importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, true);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, true);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, true);
#if UNITY_2017_3_OR_NEWER
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, true);
#else
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, true);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, true);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, true);
#endif
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, true);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, true);
                    importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.tvOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WebGL, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.Tizen, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, true);
                    importer.SetPlatformData(BuildTarget.WSAPlayer, "SDK", "UWP");
                    importer.SetPlatformData(BuildTarget.WSAPlayer, "ScriptingBackend", "Il2Cpp");
                    importer.SaveAndReimport();
                }
            }
            #endregion // General
            #region Standalone
            {
                PluginImporter importer = AssetImporter.GetAtPath("Assets/GameAnalytics/Plugins/Windows/x86/sqlite3.dll") as PluginImporter;
                if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.StandaloneWindows)))
                {
                    importer.SetCompatibleWithAnyPlatform(false);
                    importer.SetCompatibleWithEditor(false);
                    importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, false);
#if UNITY_2017_3_OR_NEWER
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
#endif
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, true);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.tvOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WebGL, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, false);
                    importer.SaveAndReimport();
                }
            }
            {
                PluginImporter importer = AssetImporter.GetAtPath("Assets/GameAnalytics/Plugins/Windows/x64/sqlite3.dll") as PluginImporter;
                if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.StandaloneWindows64)))
                {
                    importer.SetCompatibleWithAnyPlatform(false);
                    importer.SetCompatibleWithEditor(false);
                    importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, false);
#if UNITY_2017_3_OR_NEWER
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
#endif
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, true);
                    importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.tvOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WebGL, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, false);
                    importer.SaveAndReimport();
                }
            }
            {
                PluginImporter importer = AssetImporter.GetAtPath("Assets/GameAnalytics/Plugins/Linux/sqlite3.so") as PluginImporter;
                if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.StandaloneLinux) ||
                                         !importer.GetCompatibleWithPlatform(BuildTarget.StandaloneLinux64) ||
                                         !importer.GetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal)))
                {
                    importer.SetCompatibleWithAnyPlatform(false);
                    importer.SetCompatibleWithEditor(false);
                    importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, true);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, true);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, true);
#if UNITY_2017_3_OR_NEWER
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
#endif
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.tvOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WebGL, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, false);
                    importer.SaveAndReimport();
                }
            }
            #endregion // Standalone
            #region WebGL
            {
                PluginImporter importer = AssetImporter.GetAtPath("Assets/GameAnalytics/Plugins/WebGL/GameAnalytics.WebGL.dll") as PluginImporter;
                if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.WebGL)))
                {
                    importer.SetCompatibleWithAnyPlatform(false);
                    importer.SetCompatibleWithEditor(false);
                    importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, false);
#if UNITY_2017_3_OR_NEWER
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
#endif
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.tvOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WebGL, true);
                    importer.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, false);
                    importer.SaveAndReimport();
                }
            }
            {
                PluginImporter importer = AssetImporter.GetAtPath("Assets/GameAnalytics/Plugins/WebGL/HandleIO.jslib") as PluginImporter;
                if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.WebGL)))
                {
                    importer.SetCompatibleWithAnyPlatform(false);
                    importer.SetCompatibleWithEditor(false);
                    importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, false);
#if UNITY_2017_3_OR_NEWER
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
#endif
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.tvOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WebGL, true);
                    importer.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, false);
                    importer.SaveAndReimport();
                }
            }
            {
                PluginImporter importer = AssetImporter.GetAtPath("Assets/GameAnalytics/Plugins/WebGL/Mono.Data.Sqlite.dll") as PluginImporter;
                if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.WebGL)))
                {
                    importer.SetCompatibleWithAnyPlatform(false);
                    importer.SetCompatibleWithEditor(false);
                    importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, false);
#if UNITY_2017_3_OR_NEWER
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
#endif
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.tvOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WebGL, true);
                    importer.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, false);
                    importer.SaveAndReimport();
                }
            }
            {
                PluginImporter importer = AssetImporter.GetAtPath("Assets/GameAnalytics/Plugins/WebGL/sqlite.c") as PluginImporter;
                if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.WebGL)))
                {
                    importer.SetCompatibleWithAnyPlatform(false);
                    importer.SetCompatibleWithEditor(false);
                    importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, false);
#if UNITY_2017_3_OR_NEWER
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
#endif
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.tvOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WebGL, true);
                    importer.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, false);
                    importer.SaveAndReimport();
                }
            }
            {
                PluginImporter importer = AssetImporter.GetAtPath("Assets/GameAnalytics/Plugins/WebGL/sqlite.h") as PluginImporter;
                if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.WebGL)))
                {
                    importer.SetCompatibleWithAnyPlatform(false);
                    importer.SetCompatibleWithEditor(false);
                    importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, false);
#if UNITY_2017_3_OR_NEWER
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
#endif
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.tvOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WebGL, true);
                    importer.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, false);
                    importer.SaveAndReimport();
                }
            }
            #endregion // WebGL
            #region WSA
            {
                PluginImporter importer = AssetImporter.GetAtPath("Assets/GameAnalytics/Plugins/WSA/GameAnalytics.UWP.dll") as PluginImporter;
                if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.WSAPlayer) ||
                                         !importer.GetPlatformData(BuildTarget.WSAPlayer, "SDK").Equals("UWP") ||
                                         !importer.GetPlatformData(BuildTarget.WSAPlayer, "ScriptingBackend").Equals("DotNet")))
                {
                    importer.SetCompatibleWithAnyPlatform(false);
                    importer.SetCompatibleWithEditor(false);
                    importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, false);
#if UNITY_2017_3_OR_NEWER
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
#endif
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.tvOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WebGL, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, true);
                    importer.SetPlatformData(BuildTarget.WSAPlayer, "SDK", "UWP");
                    importer.SetPlatformData(BuildTarget.WSAPlayer, "ScriptingBackend", "DotNet");
                    importer.SaveAndReimport();
                }
            }
            {
                PluginImporter importer = AssetImporter.GetAtPath("Assets/GameAnalytics/Plugins/WSA/Microsoft.Data.Sqlite.dll") as PluginImporter;
                if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.WSAPlayer) ||
                                         !importer.GetPlatformData(BuildTarget.WSAPlayer, "SDK").Equals("UWP")))
                {
                    importer.SetCompatibleWithAnyPlatform(false);
                    importer.SetCompatibleWithEditor(false);
                    importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, false);
#if UNITY_2017_3_OR_NEWER
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
#endif
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.tvOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WebGL, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, true);
                    importer.SetPlatformData(BuildTarget.WSAPlayer, "SDK", "UWP");
                    importer.SaveAndReimport();
                }
            }
            {
                PluginImporter importer = AssetImporter.GetAtPath("Assets/GameAnalytics/Plugins/WSA/MetroLog.dll") as PluginImporter;
                if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.WSAPlayer) ||
                                         !importer.GetPlatformData(BuildTarget.WSAPlayer, "SDK").Equals("AnySDK")))
                {
                    importer.SetCompatibleWithAnyPlatform(false);
                    importer.SetCompatibleWithEditor(false);
                    importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, false);
#if UNITY_2017_3_OR_NEWER
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
#endif
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.tvOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WebGL, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, true);
                    importer.SetPlatformData(BuildTarget.WSAPlayer, "SDK", "AnySDK");
                    importer.SaveAndReimport();
                }
            }
            {
                PluginImporter importer = AssetImporter.GetAtPath("Assets/GameAnalytics/Plugins/WSA/x86/sqlite3.dll") as PluginImporter;
                if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.WSAPlayer) ||
                                         !importer.GetPlatformData(BuildTarget.WSAPlayer, "SDK").Equals("UWP") ||
                                         !importer.GetPlatformData(BuildTarget.WSAPlayer, "CPU").Equals("X86")))
                {
                    importer.SetCompatibleWithAnyPlatform(false);
                    importer.SetCompatibleWithEditor(false);
                    importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, false);
#if UNITY_2017_3_OR_NEWER
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
#endif
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.tvOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WebGL, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, true);
                    importer.SetPlatformData(BuildTarget.WSAPlayer, "SDK", "UWP");
                    importer.SetPlatformData(BuildTarget.WSAPlayer, "CPU", "X86");
                    importer.SaveAndReimport();
                }
            }
            {
                PluginImporter importer = AssetImporter.GetAtPath("Assets/GameAnalytics/Plugins/WSA/x64/sqlite3.dll") as PluginImporter;
                if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.WSAPlayer) ||
                                         !importer.GetPlatformData(BuildTarget.WSAPlayer, "SDK").Equals("UWP") ||
                                         !importer.GetPlatformData(BuildTarget.WSAPlayer, "CPU").Equals("X64")))
                {
                    importer.SetCompatibleWithAnyPlatform(false);
                    importer.SetCompatibleWithEditor(false);
                    importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, false);
#if UNITY_2017_3_OR_NEWER
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
#endif
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.tvOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WebGL, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, true);
                    importer.SetPlatformData(BuildTarget.WSAPlayer, "SDK", "UWP");
                    importer.SetPlatformData(BuildTarget.WSAPlayer, "CPU", "X64");
                    importer.SaveAndReimport();
                }
            }
            {
                PluginImporter importer = AssetImporter.GetAtPath("Assets/GameAnalytics/Plugins/WSA/ARM/sqlite3.dll") as PluginImporter;
                if (importer != null && (importer.GetCompatibleWithAnyPlatform() || !importer.GetCompatibleWithPlatform(BuildTarget.WSAPlayer) ||
                                         !importer.GetPlatformData(BuildTarget.WSAPlayer, "SDK").Equals("UWP") ||
                                         !importer.GetPlatformData(BuildTarget.WSAPlayer, "CPU").Equals("ARM")))
                {
                    importer.SetCompatibleWithAnyPlatform(false);
                    importer.SetCompatibleWithEditor(false);
                    importer.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinuxUniversal, false);
#if UNITY_2017_3_OR_NEWER
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
#endif
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.iOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.tvOS, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WebGL, false);
                    importer.SetCompatibleWithPlatform(BuildTarget.WSAPlayer, true);
                    importer.SetPlatformData(BuildTarget.WSAPlayer, "SDK", "UWP");
                    importer.SetPlatformData(BuildTarget.WSAPlayer, "CPU", "ARM");
                    importer.SaveAndReimport();
                }
            }
            #endregion // WSA
        }
        static void SetCompatibility(string guid, PlatformSupport[] platformSupport)
        {
            string pluginPath = AssetDatabase.GUIDToAssetPath(guid);

            PluginImporter plugin = AssetImporter.GetAtPath(pluginPath) as PluginImporter;

            if (plugin == null)
            {
                return;
            }

            bool updateRequired = false;

            if (platformSupport.Length == 0)
            {
                // Just set every platform to disabled before enabling the correct ones
                foreach (BuildTarget bt in Enum.GetValues(typeof(BuildTarget)))
                {
                    // If the build target is obsolete
                    if (bt < 0)
                    {
                        continue;
                    }

                    // Use a string here to handle issue where a platform dependency may not be installed
                    // within the current Unity Editor install
                    if (plugin.GetCompatibleWithPlatform(bt.ToString()))
                    {
                        updateRequired = true;
                    }
                }
            }
            else
            {
                foreach (PlatformSupport s in platformSupport)
                {
                    if (!plugin.GetCompatibleWithPlatform(s.platformName))
                    {
                        updateRequired = true;
                    }

                    if (plugin.GetCompatibleWithEditor() != s.editorSupport)
                    {
                        updateRequired = true;
                    }

                    if (s.editorSupport)
                    {
                        if (plugin.GetEditorData("OS") != s.editorOS ||
                            plugin.GetEditorData("CPU") != s.editorCPU)
                        {
                            updateRequired = true;
                        }
                    }
                }
            }

            if (updateRequired)
            {
#if UNITY_5_5_OR_NEWER
                plugin.ClearSettings();
#endif
                plugin.SetCompatibleWithEditor(false);
                plugin.SetCompatibleWithAnyPlatform(false);

                // Just set every platform to disabled before enabling the correct ones
                foreach (BuildTarget bt in Enum.GetValues(typeof(BuildTarget)))
                {
                    // If the build target is obsolete
                    if (bt < 0)
                    {
                        continue;
                    }

                    // Use a string here to handle issue where a platform dependency may not be installed
                    // within the current Unity Editor install
                    plugin.SetCompatibleWithPlatform(bt.ToString(), false);
                }

                foreach (PlatformSupport s in platformSupport)
                {
                    plugin.SetCompatibleWithPlatform(s.platformName, s.platformSupport);

                    plugin.SetPlatformData("Any", "Exclude Editor", (s.editorSupport ? 0 : 1).ToString());
                    plugin.SetPlatformData("Any", "Exclude " + s.platformName, (s.platformSupport ? 0 : 1).ToString());

                    if (!string.IsNullOrEmpty(s.platformCPU))
                    {
                        plugin.SetPlatformData(s.platformName, "CPU", s.platformCPU);
                    }

                    plugin.SetCompatibleWithEditor(s.editorSupport);

                    if (s.editorSupport)
                    {
                        plugin.SetEditorData("OS", s.editorOS);
                        plugin.SetEditorData("CPU", s.editorCPU);
                    }
                }

                plugin.SaveAndReimport();
            }
        }
Esempio n. 20
0
        void InitNativePlugins(XR_Enum.SDKType type, BuildTarget target, bool enable)
        {
            //string resourceName = type.ToString() + "_Assets";
            BuildSettingAssetsHolder waveVRBuildFiles = Resources.Load <BuildSettingAssetsHolder>(ConstantVar.ResourcesPath.BUILD_SETTINGS);

            XR_SDK_Plugin[] allNativePluginFiles = null;
            if (waveVRBuildFiles != null)
            {
                allNativePluginFiles = waveVRBuildFiles.GetAllPluginFiles();
            }

            if (allNativePluginFiles != null)
            {
                foreach (XR_SDK_Plugin pluginFile in allNativePluginFiles)
                {
                    PluginImporter pluginImporter = AssetImporter.GetAtPath(pluginFile.GetFilePath) as PluginImporter;
                    if (pluginImporter != null && pluginFile.buildTarget == target && pluginImporter.GetCompatibleWithPlatform(pluginFile.buildTarget) == (!enable))
                    {
                        pluginImporter.SetCompatibleWithPlatform(pluginFile.buildTarget, enable);
                    }
                }
            }
        }