Ejemplo n.º 1
0
        private void UpdatePluginPlatforms(Features _supportedFeatures)
        {
                #if !UNITY_4
            foreach (PluginImporter plugin in PluginImporter.GetAllImporters())
            {
                if (plugin == null || Path.IsPathRooted(plugin.assetPath))                  // Skip null or inbuilt plugins
                {
                    continue;
                }

                string filename = Path.GetFileName(plugin.assetPath);

                if (plugin.assetPath.Contains(Constants.kAndroidPluginsPath))
                {
                    // Debug.Log("[Updating Plugin Properties] " + plugin.assetPath);
                    if (filename.Equals(Constants.kTwitterLibraryName))
                    {
                        plugin.SetCompatibleWithAnyPlatform(false);
                        plugin.SetCompatibleWithPlatform(BuildTarget.Android, _supportedFeatures.UsesTwitter);
                    }
#if USES_MEDIA_LIBRARY
                    if (filename.Equals(Constants.kYoutubeLibraryName))
                    {
                        plugin.SetCompatibleWithAnyPlatform(false);
                        plugin.SetCompatibleWithPlatform(BuildTarget.Android, _supportedFeatures.UsesMediaLibrary && !string.IsNullOrEmpty(MediaLibrary.Android.YoutubeAPIKey));
                    }
#endif
                }
            }
                #endif
        }
        protected Dictionary <string, List <PluginImporter> > GetCompatiblePlugins(string buildTargetName, string[] defines)
        {
            var pluginImporters = PluginImporter.GetAllImporters();
            var plugins         = pluginImporters
                                  .Where(pluginImporter => IsPluginCompatible(pluginImporter, buildTargetName, defines));

            plugins = PluginImporter.FilterAssembliesByAssemblyVersion(plugins);

            var matchingPlugins = new Dictionary <string, List <PluginImporter> >();

            foreach (var plugin in plugins)
            {
                string finalPluginPath = CalculateFinalPluginPath(buildTargetName, plugin);
                if (string.IsNullOrEmpty(finalPluginPath))
                {
                    continue;
                }

                if (!matchingPlugins.TryGetValue(finalPluginPath, out var pluginsList))
                {
                    pluginsList = new List <PluginImporter>();
                    matchingPlugins[finalPluginPath] = pluginsList;
                }
                pluginsList.Add(plugin);
            }

            return(matchingPlugins);
        }
        /// <summary>OnPreprocessBuild override to provide XR Plugin specific build actions.</summary>
        /// <param name="report">The build report.</param>
        public override void OnPreprocessBuild(BuildReport report)
        {
            base.OnPreprocessBuild(report);

            var allPlugins = PluginImporter.GetAllImporters();

            foreach (var plugin in allPlugins)
            {
                if (plugin.isNativePlugin)
                {
                    foreach (var pluginName in remotingPluginNames)
                    {
                        if (plugin.assetPath.Contains(pluginName))
                        {
                            plugin.SetIncludeInBuildDelegate(ShouldIncludeRemotingPluginsInBuild);
                            break;
                        }
                    }

                    foreach (var pluginName in runtimePluginNames)
                    {
                        if (plugin.assetPath.Contains(pluginName))
                        {
                            plugin.SetIncludeInBuildDelegate(ShouldIncludeRuntimePluginsInBuild);
                            break;
                        }
                    }

                    if (plugin.assetPath.Contains(spatializerPluginName))
                    {
                        plugin.SetIncludeInBuildDelegate(ShouldIncludeSpatializerPluginsInBuild);
                    }
                }
            }
        }
Ejemplo n.º 4
0
    public static void SetPluginImportEnabled(BuildTarget buildTarget, bool enabled)
    {
                #if UNITY_5_OR_LATER
        try
        {
            PluginImporter[] pluginImporters = PluginImporter.GetAllImporters();
#if UNITY_TVOS
            bool hasPlatform_tvOS = true;
#else
            bool hasPlatform_tvOS = false;
#endif

            foreach (PluginImporter pluginImporter in pluginImporters)
            {
                bool pluginImporter_iOS     = pluginImporter.assetPath.Contains("Plugins/Everyplay/iOS");
                bool pluginImporter_tvOS    = pluginImporter.assetPath.Contains("Plugins/Everyplay/tvOS");
                bool pluginImporter_Android = pluginImporter.assetPath.Contains("Plugins/Android/everyplay");

                if (pluginImporter_iOS ||
                    pluginImporter_tvOS ||
                    pluginImporter_Android)
                {
                    pluginImporter.SetCompatibleWithAnyPlatform(false);
                    pluginImporter.SetCompatibleWithEditor(false);

                    if (((buildTarget == kBuildTarget_iOS) && pluginImporter_iOS) ||
                        ((buildTarget == kBuildTarget_tvOS && hasPlatform_tvOS) && pluginImporter_tvOS))
                    {
                        pluginImporter.SetCompatibleWithPlatform(buildTarget, enabled);

                        if (enabled)
                        {
                            string dependencies = "";

                            foreach (string framework in frameworkDependencies)
                            {
                                dependencies += framework + ";";
                            }
                            foreach (string framework in weakFrameworkDependencies)
                            {
                                dependencies += framework + ";";
                            }

                            // Is there a way to make some dependencies weak in PluginImporter?
                            pluginImporter.SetPlatformData(buildTarget, "FrameworkDependencies", dependencies);
                        }
                    }
                    else if ((buildTarget == BuildTarget.Android) && pluginImporter_Android)
                    {
                        pluginImporter.SetCompatibleWithPlatform(buildTarget, enabled);
                    }
                }
            }
        }
        catch (Exception e)
        {
            Debug.Log("Changing plugin import settings failed: " + e);
        }
                #endif
    }
        public TriLibSettingsProvider(string path, SettingsScope scopes = SettingsScope.User, IEnumerable <string> keywords = null) : base(path, scopes, keywords)
        {
            var settingsAssetGuids = AssetDatabase.FindAssets("TriLibReaders");

            if (settingsAssetGuids.Length > 0)
            {
                _settingsFilePath = AssetDatabase.GUIDToAssetPath(settingsAssetGuids[0]);
            }
            else
            {
                throw new Exception("Could not find TriLibReaders.cs file. Please re-import TriLib package.");
            }
            _importerOptions = new List <ImporterOption>();
            var pluginImporters = PluginImporter.GetAllImporters();

            foreach (var pluginImporter in pluginImporters)
            {
                if (!pluginImporter.isNativePlugin && pluginImporter.assetPath.Contains("TriLibCore."))
                {
                    var assembly = Assembly.LoadFile(pluginImporter.assetPath);
                    foreach (var type in assembly.ExportedTypes)
                    {
                        if (type.BaseType == typeof(ReaderBase))
                        {
                            _importerOptions.Add(new ImporterOption(type.Name, type.Namespace, pluginImporter));
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
    static void SetPlatformSettings()
    {
        foreach (var plugin in PluginImporter.GetAllImporters())
        {
            // Skip any absolute paths, as they are only built in plugins.
            if (Path.IsPathRooted(plugin.assetPath))
            {
                continue;
            }

            string filename = Path.GetFileName(plugin.assetPath);
            switch (filename)
            {
            case "CSteamworks.bundle":
                ResetPluginSettings(plugin, "AnyCPU", "OSX");
                SetCompatibleWithOSX(plugin);
                break;

            case "libCSteamworks.so":
            case "libsteam_api.so":
                if (plugin.assetPath.Contains("x86_64"))
                {
                    ResetPluginSettings(plugin, "x86_64", "Linux");
                    SetCompatibleWithLinux(plugin, BuildTarget.StandaloneLinux64);
                }
                else
                {
                    ResetPluginSettings(plugin, "x86", "Linux");
                    SetCompatibleWithLinux(plugin, BuildTarget.StandaloneLinux);
                }
                break;

            case "CSteamworks.dll":
                if (plugin.assetPath.Contains("x86_64"))
                {
                    ResetPluginSettings(plugin, "x86_64", "Windows");
                    SetCompatibleWithWindows(plugin, BuildTarget.StandaloneWindows64);
                }
                else
                {
                    ResetPluginSettings(plugin, "x86", "Windows");
                    SetCompatibleWithWindows(plugin, BuildTarget.StandaloneWindows);
                }
                break;

            case "steam_api.dll":
            case "steam_api64.dll":
                if (plugin.assetPath.Contains("x86_64"))
                {
                    ResetPluginSettings(plugin, "x86_64", "Windows");
                }
                else
                {
                    ResetPluginSettings(plugin, "x86", "Windows");
                }
                SetCompatibleWithEditor(plugin);
                break;
            }
        }
    }
Ejemplo n.º 7
0
        void AssignNativePluginIncludeInBuildDelegates()
        {
            // For each plugin within the project, check if it is a plugin generated by this
            // package and assign the Include in build delegate to prevent magic leap libraries
            // from being included on other platforms
            var allPlugins = PluginImporter.GetAllImporters();

            foreach (var plugin in allPlugins)
            {
                if (plugin.isNativePlugin)
                {
                    foreach (var pluginName in runtimePluginNames)
                    {
                        if (plugin.assetPath.Contains(pluginName))
                        {
                            plugin.SetIncludeInBuildDelegate(ShouldIncludeRuntimePluginsInBuild);
                            break;
                        }
                    }

                    foreach (var pluginName in remotingPluginNames)
                    {
                        if (plugin.assetPath.Contains(pluginName))
                        {
                            plugin.SetIncludeInBuildDelegate(ShouldIncludeRemotingPluginsInBuild);
                            break;
                        }
                    }
                }
            }
        }
        protected Dictionary <string, List <PluginImporter> > GetCompatiblePlugins(string buildTargetName)
        {
            PluginImporter[] array = (
                from imp in PluginImporter.GetAllImporters()
                where (imp.GetCompatibleWithPlatform(buildTargetName) || imp.GetCompatibleWithAnyPlatform()) && !string.IsNullOrEmpty(imp.assetPath)
                select imp).ToArray <PluginImporter>();
            Dictionary <string, List <PluginImporter> > dictionary = new Dictionary <string, List <PluginImporter> >();

            PluginImporter[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                PluginImporter pluginImporter = array2[i];
                if (!string.IsNullOrEmpty(pluginImporter.assetPath))
                {
                    string text = this.CalculateFinalPluginPath(buildTargetName, pluginImporter);
                    if (!string.IsNullOrEmpty(text))
                    {
                        List <PluginImporter> list = null;
                        if (!dictionary.TryGetValue(text, out list))
                        {
                            list             = new List <PluginImporter>();
                            dictionary[text] = list;
                        }
                        list.Add(pluginImporter);
                    }
                }
            }
            return(dictionary);
        }
Ejemplo n.º 9
0
        protected Dictionary <string, List <PluginImporter> > GetCompatiblePlugins(string buildTargetName)
        {
            var assemblies      = CompilationPipeline.GetAssemblies();
            var assemblyDefines = new Dictionary <string, string[]>(assemblies.Length);

            foreach (var assembly in assemblies)
            {
                assemblyDefines.Add(assembly.name, assembly.defines);
            }

            IEnumerable <PluginImporter> plugins = PluginImporter.GetAllImporters().Where(imp => imp.GetCompatibleWithPlatformOrAnyPlatformBuildTarget(buildTargetName) && imp.IsCompatibleWithDefines(assemblyDefines.ContainsKey(imp.name) ? assemblyDefines[imp.name] : null));
            Dictionary <string, List <PluginImporter> > matchingPlugins = new Dictionary <string, List <PluginImporter> >();

            foreach (var plugin in plugins)
            {
                string finalPluginPath = CalculateFinalPluginPath(buildTargetName, plugin);
                if (string.IsNullOrEmpty(finalPluginPath))
                {
                    continue;
                }

                List <PluginImporter> temp = null;
                if (matchingPlugins.TryGetValue(finalPluginPath, out temp) == false)
                {
                    temp = new List <PluginImporter>();
                    matchingPlugins[finalPluginPath] = temp;
                }
                temp.Add(plugin);
            }
            return(matchingPlugins);
        }
Ejemplo n.º 10
0
        public static void ConfigurePluginPlatforms()
        {
            PluginImporter[] importers     = PluginImporter.GetAllImporters();
            PluginImporter   iOSPlugin     = null;
            PluginImporter   androidPlugin = null;

            foreach (PluginImporter importer in importers)
            {
                if (importer.assetPath.Contains(AudienceNetworkFramework))
                {
                    iOSPlugin = importer;
                    Debug.Log("Audience Network iOS plugin found at " + importer.assetPath + ".");
                }
                else if (importer.assetPath.Contains(AudienceNetworkAAR))
                {
                    androidPlugin = importer;
                    Debug.Log("Audience Network Android plugin found at " + importer.assetPath + ".");
                }
            }
            if (iOSPlugin != null)
            {
                iOSPlugin.SetCompatibleWithAnyPlatform(false);
                iOSPlugin.SetCompatibleWithEditor(false);
                iOSPlugin.SetCompatibleWithPlatform(BuildTarget.iOS, true);
                iOSPlugin.SetPlatformData(BuildTarget.iOS, FrameworkDependenciesKey, RequiredFrameworks);
                iOSPlugin.SaveAndReimport();
            }
            if (androidPlugin != null)
            {
                androidPlugin.SetCompatibleWithAnyPlatform(false);
                androidPlugin.SetCompatibleWithEditor(false);
                androidPlugin.SetCompatibleWithPlatform(BuildTarget.Android, true);
                androidPlugin.SaveAndReimport();
            }
        }
        protected Dictionary <string, List <PluginImporter> > GetCompatiblePlugins(string buildTargetName)
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            DefaultPluginImporterExtension.\u003CGetCompatiblePlugins\u003Ec__AnonStorey7D pluginsCAnonStorey7D = new DefaultPluginImporterExtension.\u003CGetCompatiblePlugins\u003Ec__AnonStorey7D();
            // ISSUE: reference to a compiler-generated field
            pluginsCAnonStorey7D.buildTargetName = buildTargetName;
            // ISSUE: reference to a compiler-generated method
            PluginImporter[] array = ((IEnumerable <PluginImporter>)PluginImporter.GetAllImporters()).Where <PluginImporter>(new Func <PluginImporter, bool>(pluginsCAnonStorey7D.\u003C\u003Em__125)).ToArray <PluginImporter>();
            Dictionary <string, List <PluginImporter> > dictionary = new Dictionary <string, List <PluginImporter> >();
            // ISSUE: reference to a compiler-generated field
            BuildTargetGroup targetGroupByName = BuildPipeline.GetBuildTargetGroupByName(pluginsCAnonStorey7D.buildTargetName);

            foreach (PluginImporter imp in array)
            {
                if (!string.IsNullOrEmpty(imp.assetPath))
                {
                    // ISSUE: reference to a compiler-generated field
                    string finalPluginPath = this.CalculateFinalPluginPath(pluginsCAnonStorey7D.buildTargetName, imp);
                    if (!string.IsNullOrEmpty(finalPluginPath) && (!imp.isNativePlugin || targetGroupByName != BuildTargetGroup.WebPlayer))
                    {
                        List <PluginImporter> pluginImporterList = (List <PluginImporter>)null;
                        if (!dictionary.TryGetValue(finalPluginPath, out pluginImporterList))
                        {
                            pluginImporterList          = new List <PluginImporter>();
                            dictionary[finalPluginPath] = pluginImporterList;
                        }
                        pluginImporterList.Add(imp);
                    }
                }
            }
            return(dictionary);
        }
Ejemplo n.º 12
0
        /// <summary>OnPreprocessBuild override to provide XR Plugin specific build actions.</summary>
        /// <param name="report">The build report.</param>
        public override void OnPreprocessBuild(BuildReport report)
        {
            if (IsCurrentBuildTargetVaild(report) && HasLoaderEnabledForTarget(report.summary.platformGroup))
            {
                base.OnPreprocessBuild(report);
            }

            var allPlugins = PluginImporter.GetAllImporters();

            foreach (var plugin in allPlugins)
            {
                if (plugin.isNativePlugin)
                {
                    foreach (var pluginName in runtimePluginNames)
                    {
                        if (plugin.assetPath.Contains(pluginName))
                        {
                            plugin.SetIncludeInBuildDelegate((path) => { return(ShouldIncludeRuntimePluginsInBuild(path, report.summary.platformGroup)); });
                            break;
                        }
                    }

                    // exlude spatializer related plugins if OculusSpatializer not selected under Audio setting
                    if (plugin.assetPath.Contains(spatializerPluginName))
                    {
                        plugin.SetIncludeInBuildDelegate(ShouldIncludeSpatializerPluginsInBuild);
                    }
                }
            }
        }
Ejemplo n.º 13
0
//    [MenuItem("Test/Test")]
    public static void Test()
    {
        foreach (var pluginImporter in PluginImporter.GetAllImporters())
        {
            Debug.Log(pluginImporter.assetPath);
        }
    }
        // Handle delayed loading of the dependency resolvers.
        private static void OnPostprocessAllAssets(
            string[] importedAssets, string[] deletedAssets,
            string[] movedAssets, string[] movedFromPath)
        {
            foreach (string asset in importedAssets)
            {
                if (asset.Contains("IOSResolver") || asset.Contains("JarResolver"))
                {
                    RegisterDependencies();
                    break;
                }
            }

            UnitySocialSettings settings = UnitySocialSettingsEditor.LoadSettings();

            if (settings == null)
            {
                return;
            }

            PluginImporter[] pluginImporters = PluginImporter.GetAllImporters();
            foreach (PluginImporter pluginImporter in pluginImporters)
            {
                if (pluginImporter.assetPath.Contains("Plugins/UnitySocial/Native/Android"))
                {
                    pluginImporter.SetCompatibleWithPlatform(BuildTarget.Android, settings.androidSupportEnabled);
                }
            }

            SetAndroidManifestConfig(settings);
        }
        static void UpdatePluginSettings()
        {
            // Unregister callback (executed only once)
            EditorApplication.update -= UpdatePluginSettings;

            PluginImporter[] importers = PluginImporter.GetAllImporters();
            foreach (var imp in importers)
            {
                string pluginPath             = imp.assetPath;
                bool   isVuforiaWrapperPlugin =
                    pluginPath.EndsWith("QCARWrapper.dll") || pluginPath.EndsWith("VuforiaWrapper.dll") ||
                    pluginPath.EndsWith("QCARWrapper.bundle") || pluginPath.EndsWith("VuforiaWrapper.bundle");
                if (isVuforiaWrapperPlugin && imp.GetCompatibleWithAnyPlatform())
                {
                    Debug.Log("Setting platform to 'Editor' for plugin: " + pluginPath);
                    imp.SetCompatibleWithAnyPlatform(false);
                    imp.SetCompatibleWithEditor(true);
                }
            }



            // create default Vuforia Configuration and check clipping shader
            var config        = VuforiaConfigurationEditor.LoadConfigurationObject();
            var videoBgConfig = config.VideoBackground;

            if (videoBgConfig.MatteShader == null && videoBgConfig.ClippingMode != HideExcessAreaAbstractBehaviour.CLIPPING_MODE.NONE)
            {
                Undo.RecordObject(config, "Setting Matte Shader");
                videoBgConfig.SetDefaultMatteShader();
                EditorUtility.SetDirty(config);
            }
        }
Ejemplo n.º 16
0
        private void UpdatePluginPlatforms(ApplicationSettings.Features _supportedFeatures)
        {
            foreach (PluginImporter plugin in PluginImporter.GetAllImporters())
            {
                if (plugin == null || Path.IsPathRooted(plugin.assetPath))                          // Skip null or inbuilt plugins
                {
                    continue;
                }

                string filename = Path.GetFileName(plugin.assetPath);

                if (plugin.assetPath.Contains(Constants.kAndroidPluginsPath))
                {
                    // Debug.Log("[Updating Plugin Properties] " + plugin.assetPath);
                    if (filename.Equals(Constants.kTwitterLibraryName))
                    {
                        plugin.SetCompatibleWithAnyPlatform(false);
                        plugin.SetCompatibleWithPlatform(BuildTarget.Android, _supportedFeatures.UsesTwitter);
                    }

                    if (filename.Equals(Constants.kYoutubeLibraryName))
                    {
                        plugin.SetCompatibleWithAnyPlatform(false);
                        plugin.SetCompatibleWithPlatform(BuildTarget.Android, _supportedFeatures.UsesMediaLibrary);
                    }
                }
            }
        }
Ejemplo n.º 17
0
    public static void DeactivateAllPlugins()
    {
        PluginImporter[] importers = PluginImporter.GetAllImporters();

        foreach (PluginImporter pluginImporter in importers)
        {
            pluginImporter.SetCompatibleWithAnyPlatform(false);
            AssetDatabase.ImportAsset(pluginImporter.assetPath);
        }
    }
 private static void EnableAndroidSupport(bool enabled)
 {
     PluginImporter[] pluginImporters = PluginImporter.GetAllImporters();
     foreach (PluginImporter pluginImporter in pluginImporters)
     {
         if (pluginImporter.assetPath.Contains("Plugins/UnitySocial/Native/Android"))
         {
             pluginImporter.SetCompatibleWithPlatform(BuildTarget.Android, enabled);
         }
     }
 }
        public static string GetLoaderLibraryPath()
        {
            var extensions = FeatureHelpersInternal.GetAllFeatureInfo(BuildTargetGroup.Standalone);

            // Loop over all the native plugin importers and find the custom loader
            var importers = PluginImporter.GetAllImporters();

            foreach (var importer in importers)
            {
                if (!importer.GetCompatibleWithEditor() || !importer.assetPath.Contains("openxr_loader"))
                {
                    continue;
                }

#if UNITY_EDITOR_WIN
                if (!importer.GetCompatibleWithPlatform(BuildTarget.StandaloneWindows64) || !importer.assetPath.EndsWith(".dll"))
                {
                    continue;
                }
#elif UNITY_EDITOR_OSX
                if (!importer.GetCompatibleWithPlatform(BuildTarget.StandaloneOSX) || !importer.assetPath.EndsWith(".dylib"))
                {
                    continue;
                }
#endif

                bool importerPartOfExtension = false;
                var  root = Path.GetDirectoryName(importer.assetPath);
                foreach (var extInfo in extensions.Features)
                {
                    bool extensionContainsLoader = (root != null && root.Contains(extInfo.PluginPath));
                    importerPartOfExtension |= extensionContainsLoader;

                    bool customRuntimeLoaderOnEditorTarget = extInfo.Attribute.CustomRuntimeLoaderBuildTargets?.Intersect(
                        new[] { BuildTarget.StandaloneWindows64, BuildTarget.StandaloneOSX, BuildTarget.StandaloneLinux64 }).Any() ?? false;

                    if (extensionContainsLoader &&
                        customRuntimeLoaderOnEditorTarget &&
                        extInfo.Feature.enabled)
                    {
                        return(AssetPathToAbsolutePath(importer.assetPath));
                    }
                }

                // return default loader
                bool hasCustomLoader = extensions.CustomLoaderBuildTargets?.Length > 0;
                if (!importerPartOfExtension && !hasCustomLoader)
                {
                    return(AssetPathToAbsolutePath(importer.assetPath));
                }
            }

            return("");
        }
 void SetRuntimePluginCopyDelegate()
 {
     foreach (var plugin in PluginImporter.GetAllImporters())
     {
         if (plugin.isNativePlugin &&
             k_RuntimePluginNames.Any(pluginName => plugin.assetPath.Contains(pluginName)))
         {
             plugin.SetIncludeInBuildDelegate(path => isARCoreLoaderEnabled);
         }
     }
 }
Ejemplo n.º 21
0
        internal static void Recompile()
        {
            var importer = PluginImporter.GetAllImporters().FirstOrDefault(i => i.assetPath.EndsWith("UniGitResources.dll"));

            if (importer == null)
            {
                Debug.LogError("Could not find LibGit2Sharp.dll. You will have to close and open Unity to recompile scripts.");
                return;
            }
            importer.SetCompatibleWithEditor(true);
            importer.SaveAndReimport();
        }
Ejemplo n.º 22
0
        private static void RemoveLegacyPluginFiles()
        {
            List <SFileToDelete> aFilesToDelete = new List <SFileToDelete>();

#if (UNITY_EDITOR && UNITY_ANDROID)
            aFilesToDelete.Add(new SFileToDelete("Android/guava-27.1-android.jar"));
#endif

            if (aFilesToDelete.Count > 0)
            {
                int    iNumFoundFilesToDelete = 0;
                string aFilesToDeleteString   = "";

                PluginImporter[] importers = PluginImporter.GetAllImporters();
                foreach (PluginImporter pi in importers)
                {
                    foreach (SFileToDelete fileToDelete in aFilesToDelete)
                    {
                        string pluginFilename = pi.assetPath;
                        pluginFilename.Replace("\\", "/");
                        if (pluginFilename.Contains(fileToDelete.filename))
                        {
                            fileToDelete.fullPath = pi.assetPath;
                            fileToDelete.found    = true;

                            if (iNumFoundFilesToDelete > 0)
                            {
                                aFilesToDeleteString += "\n";
                            }
                            aFilesToDeleteString += pi.assetPath;
                            ++iNumFoundFilesToDelete;
                        }
                    }
                }

                if (iNumFoundFilesToDelete > 0)
                {
                    string message = (iNumFoundFilesToDelete == 1) ? "A legacy AVPro Video plugin file has been found that requires deleting in order to build." : "Legacy AVPro Video plugin files have been found that require deleting in order to build.";
                    Debug.Log("[AVProVideo] " + message + " Files: " + aFilesToDeleteString);
                    if (EditorUtility.DisplayDialog("AVPro Video Legacy File", message + "\n\nDelete the following files?\n\n" + aFilesToDeleteString, "Delete", "Ignore"))
                    {
                        foreach (SFileToDelete fileToDelete in aFilesToDelete)
                        {
                            bool bDeleted = AssetDatabase.DeleteAsset(fileToDelete.fullPath);
                            if (bDeleted)
                            {
                                Debug.Log("[AVProVideo] Deleting " + fileToDelete.fullPath);
                            }
                        }
                    }
                }
            }
        }
        static void InitializeOnLoad()
        {
            var importers = PluginImporter.GetAllImporters();

            // fixes asset bundle building since IPreProcessBuildWithReport isn't called
            foreach (var importer in importers)
            {
                if (importer.assetPath.Contains("openxr_loader"))
                {
                    importer.SetIncludeInBuildDelegate(path => false);
                }
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Helper function to disable the Remote Debug plugin before building.
        /// Call this function before starting your build.
        /// </summary>
        /// <param name="buildTarget"></param>
        public static void DisableRemoteDebug(BuildTarget buildTarget)
        {
            var importers = PluginImporter.GetAllImporters();
            var dllName   = GetRemoteDebugDLLName(buildTarget);

            foreach (var importer in importers)
            {
                if (importer.assetPath.IndexOf(dllName, StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    Debug.Log("Remote Debug: Disabling Remote Debug plugin..");
                    importer.SetCompatibleWithPlatform(buildTarget, false);
                }
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Returns the path to Remote Debug.
        /// </summary>
        /// <returns>Relative plugin path</returns>
        private static string FindRemoteDebugPath()
        {
            var importers = PluginImporter.GetAllImporters();

            foreach (var importer in importers)
            {
                if (importer.assetPath.IndexOf("HdgRemoteDebugRuntime", StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    return(importer.assetPath);
                }
            }

            return("");
        }
    public static void SetPluginImportEnabled(BuildTarget buildTarget, bool enabled)
    {
        #if !(UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6)
        try
        {
            PluginImporter[] pluginImporters = PluginImporter.GetAllImporters();

            foreach (PluginImporter pluginImporter in pluginImporters)
            {
                bool everyplayIosPluginImporter     = pluginImporter.assetPath.Contains("Plugins/Everyplay/iOS");
                bool everyplayAndroidPluginImporter = pluginImporter.assetPath.Contains("Plugins/Android/everyplay");

                if (everyplayIosPluginImporter || everyplayAndroidPluginImporter)
                {
                    pluginImporter.SetCompatibleWithAnyPlatform(false);
                    pluginImporter.SetCompatibleWithEditor(false);

                    if ((buildTarget == kBuildTargetIOS) && everyplayIosPluginImporter)
                    {
                        pluginImporter.SetCompatibleWithPlatform(buildTarget, enabled);

                        if (enabled)
                        {
                            string frameworkDependencies = "AssetsLibrary;" +
                                                           "MessageUI;" +
                                                           "Security;" +
                                                           "StoreKit;";

                            string weakFrameworkDependencies = "Social;" +
                                                               "CoreImage;" +
                                                               "Twitter;" +
                                                               "Accounts;";

                            // Is there a way to make some dependencies weak in PluginImporter?
                            pluginImporter.SetPlatformData(kBuildTargetIOS, "FrameworkDependencies", frameworkDependencies + weakFrameworkDependencies);
                        }
                    }
                    else if ((buildTarget == BuildTarget.Android) && everyplayAndroidPluginImporter)
                    {
                        pluginImporter.SetCompatibleWithPlatform(buildTarget, enabled);
                    }
                }
            }
        }
        catch (Exception e)
        {
            Debug.Log("Changing plugin import settings failed: " + e);
        }
        #endif
    }
Ejemplo n.º 27
0
    public static void DeactivateAllPlugins()
    {
        PluginImporter[] importers = PluginImporter.GetAllImporters();

        foreach (PluginImporter pluginImporter in importers)
        {
            if (!pluginImporter.assetPath.Contains(WwisePluginFolder))
            {
                continue;
            }

            pluginImporter.SetCompatibleWithAnyPlatform(false);
            AssetDatabase.ImportAsset(pluginImporter.assetPath);
        }
    }
Ejemplo n.º 28
0
        static void UpdateVuforiaMediaPluginSettings()
        {
            // Unregister callback (executed only once)
            EditorApplication.update -= UpdateVuforiaMediaPluginSettings;

            PluginImporter[] importers = PluginImporter.GetAllImporters();
            foreach (var imp in importers)
            {
                string pluginPath = imp.assetPath;
                if (pluginPath.EndsWith("VuforiaMediaSource") && imp.GetCompatibleWithAnyPlatform())
                {
                    Debug.Log("Disabling 'Any Platform' for plugin: " + pluginPath);
                    imp.SetCompatibleWithAnyPlatform(false);
                }
            }
        }
    static public void Run()
    {
        // called only once
        if (!File.Exists(tempFilePath))
        {
            var importers = PluginImporter.GetAllImporters().Where(importer => importer.assetPath.Contains("libEffekseerUnity.bc"));

            if (importers.Count() > 0)
            {
                foreach (var importer in importers)
                {
                    importer.SetCompatibleWithPlatform(BuildTarget.WebGL, importer.assetPath.Contains(bcPath));
                }
                File.Create(tempFilePath);
            }
        }
    }
        public void OnPreprocessBuild(BuildReport report)
        {
            var extensions = FeatureHelpersInternal.GetAllFeatureInfo(report.summary.platformGroup);

            // Keep set of seen plugins, only disable plugins that haven't been seen.
            HashSet <string> seenPlugins = new HashSet <string>();

            // Loop over all the native plugin importers and only include the enabled ones in the build
            var importers = PluginImporter.GetAllImporters();

            foreach (var importer in importers)
            {
                if (!importer.GetCompatibleWithPlatform(report.summary.platform))
                {
                    continue;
                }
                if (importer.assetPath.Contains("openxr_loader"))
                {
                    if (extensions.CustomLoaderBuildTargets?.Contains(report.summary.platform) ?? false)
                    {
                        importer.SetIncludeInBuildDelegate(path => false);
                    }
                    else
                    {
                        importer.SetIncludeInBuildDelegate(path => true);
                    }
                }

                var root = Path.GetDirectoryName(importer.assetPath);
                foreach (var extInfo in extensions.Features)
                {
                    if (root != null && root.Contains(extInfo.PluginPath))
                    {
                        if (extInfo.Feature.enabled)
                        {
                            importer.SetIncludeInBuildDelegate(path => true);
                        }
                        else if (!seenPlugins.Contains(importer.assetPath))
                        {
                            importer.SetIncludeInBuildDelegate(path => false);
                        }
                        seenPlugins.Add(importer.assetPath);
                    }
                }
            }
        }