private static void SetExcludeEditorFromAnyPlatform(PluginImporter pluginImporter, bool enable) { if (pluginImporter.GetExcludeEditorFromAnyPlatform() != enable) { pluginImporter.SetExcludeEditorFromAnyPlatform(enable); mHasAtLeastOneLibraryBeenModified = true; } }
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(); } } }