private static void SetExcludeFromAnyPlatform(PluginImporter pluginImporter, BuildTarget buildTarget, bool enable)
 {
     if (pluginImporter.GetExcludeFromAnyPlatform(buildTarget) != enable)
     {
         pluginImporter.SetExcludeFromAnyPlatform(buildTarget, enable);
         mHasAtLeastOneLibraryBeenModified = true;
     }
 }
        internal bool UpdateIncompatibleWithPlatforms(PluginImporter pluginImporter)
        {
            var hasUpdated = false;

            foreach (var incompatiblePlatform in IncompatiblePlatforms)
            {
                if (!pluginImporter.GetExcludeFromAnyPlatform(incompatiblePlatform))
                {
                    pluginImporter.SetExcludeFromAnyPlatform(incompatiblePlatform, true);
                    hasUpdated = true;
                }
            }

            return(hasUpdated);
        }
Exemplo n.º 3
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();
            }
        }
    }