コード例 #1
0
        public override void PostBuild(NativePlugin plugin, NativeBuildOptions buildOptions)
        {
            base.PostBuild(plugin, buildOptions);

            string assetFile = CombinePath(
                AssetDatabase.GetAssetPath(plugin.pluginBinaryFolder),
                "Linux",
                buildOptions.Architecture.ToString(),
                string.Format("lib{0}.so", plugin.Name));

            PluginImporter pluginImporter = PluginImporter.GetAtPath((assetFile)) as PluginImporter;

            if (pluginImporter != null)
            {
                SetPluginBaseInfo(plugin, buildOptions, pluginImporter);

                pluginImporter.SetCompatibleWithAnyPlatform(false);
                pluginImporter.SetCompatibleWithEditor(true);
                pluginImporter.SetEditorData("OS", "Linux");
                pluginImporter.SetEditorData("CPU", buildOptions.Architecture.ToString());
                if (buildOptions.Architecture == Architecture.x86)
                {
                    pluginImporter.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux, true);
                }
                else
                {
                    pluginImporter.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, true);
                }

                pluginImporter.SaveAndReimport();
            }
        }
コード例 #2
0
    static bool ResetPluginSettings(PluginImporter plugin, string CPU, string OS)
    {
        bool didUpdate = false;

        if (plugin.GetCompatibleWithAnyPlatform() != false)
        {
            plugin.SetCompatibleWithAnyPlatform(false);
            didUpdate = true;
        }

        if (plugin.GetCompatibleWithEditor() != true)
        {
            plugin.SetCompatibleWithEditor(true);
            didUpdate = true;
        }

        if (plugin.GetEditorData("CPU") != CPU)
        {
            plugin.SetEditorData("CPU", CPU);
            didUpdate = true;
        }

        if (plugin.GetEditorData("OS") != OS)
        {
            plugin.SetEditorData("OS", OS);
            didUpdate = true;
        }

        return(didUpdate);
    }
コード例 #3
0
        public override void PostBuild(NativePlugin plugin, NativeBuildOptions buildOptions)
        {
            base.PostBuild(plugin, buildOptions);

            string archName = buildOptions.Architecture == Architecture.ARMv7 ? "armeabi-v7a" : "x86";

            string assetFile = CombinePath(
                AssetDatabase.GetAssetPath(plugin.pluginBinaryFolder),
                "Android",
                archName,
                string.Format("lib{0}.so", plugin.Name));

            PluginImporter pluginImporter = PluginImporter.GetAtPath((assetFile)) as PluginImporter;

            if (pluginImporter != null)
            {
                SetPluginBaseInfo(plugin, buildOptions, pluginImporter);

                pluginImporter.SetCompatibleWithAnyPlatform(false);
                pluginImporter.SetCompatibleWithPlatform(BuildTarget.Android, true);
                pluginImporter.SetEditorData("CPU", buildOptions.Architecture.ToString());
                pluginImporter.SetEditorData("ANDROID_SDK_VERSION", buildOptions.AndroidSdkVersion.ToString());

                pluginImporter.SaveAndReimport();
            }
        }
コード例 #4
0
ファイル: RedistInstall.cs プロジェクト: fqkw6/Steamworks.NET
    static void ResetPluginSettings(PluginImporter plugin, string CPU, string OS)
    {
#if UNITY_5_5_OR_NEWER
        plugin.ClearSettings();
#endif
        plugin.SetCompatibleWithAnyPlatform(false);
        plugin.SetCompatibleWithEditor(true);
        plugin.SetEditorData("CPU", CPU);
        plugin.SetEditorData("OS", OS);
    }
コード例 #5
0
    private static void SetEditorData(PluginImporter pluginImporter, string cpu, string os)
    {
        if (!pluginImporter.GetEditorData("CPU").Equals(cpu))
        {
            pluginImporter.SetEditorData("CPU", cpu);
            mHasAtLeastOneLibraryBeenModified = true;
        }

        if (!pluginImporter.GetEditorData("OS").Equals(os))
        {
            pluginImporter.SetEditorData("OS", os);
            mHasAtLeastOneLibraryBeenModified = true;
        }
    }
 private static void SetTargetCPU(PluginImporter pluginImporter, List <BuildTarget> buildTargets, string editorCPU, string targetCPU, string targetOS, bool addToEditor)
 {
     foreach (var buildTarget in buildTargets)
     {
         Debug.LogFormat("TriLib: Changing Target CPU of '{0}' to '{1}'", pluginImporter.assetPath, targetCPU);
         pluginImporter.SetPlatformData(buildTarget, "CPU", targetCPU);
     }
     if (addToEditor)
     {
         Debug.LogFormat("TriLib: Changing Editor Target CPU of '{0}' to '{1}'", pluginImporter.assetPath, editorCPU);
         pluginImporter.SetEditorData("CPU", editorCPU);
         Debug.LogFormat("TriLib: Changing Editor Target OS of '{0}' to '{1}'", pluginImporter.assetPath, targetOS);
         pluginImporter.SetEditorData("OS", targetOS);
     }
 }
コード例 #7
0
	static void OnPostprocessAllAssets ( string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths ) 
	{
#if false //UNITY_5_0
		foreach ( string asset in importedAssets )
		{
			if ( asset.ToLower() == "assets/plugins/x86/oculusplugin.dll" || asset.ToLower() == "assets/plugins/x86_64/oculusplugin.dll" ) 
			{
				Debug.Log( "[OVRImportProcessor] Updating plugin compatibility: "  + asset );
				PluginImporter pluginImporter =  PluginImporter.GetAtPath( asset ) as PluginImporter;
				if ( pluginImporter != null ) 
				{
					bool x86_64 = asset.Contains( "x86_64" ); 
					pluginImporter.SetCompatibleWithEditor( true );
					pluginImporter.SetCompatibleWithAnyPlatform( false );
					pluginImporter.SetEditorData( "OS", "Windows" );
					if ( x86_64 ) 
					{
						pluginImporter.SetCompatibleWithPlatform( BuildTarget.StandaloneWindows, false );
						pluginImporter.SetCompatibleWithPlatform( BuildTarget.StandaloneWindows64, true );
					} 
					else 
					{
						pluginImporter.SetCompatibleWithPlatform( BuildTarget.StandaloneWindows64, false );
						pluginImporter.SetCompatibleWithPlatform( BuildTarget.StandaloneWindows, true );
					}
				}
				AssetDatabase.WriteImportSettingsIfDirty( asset );
			}
		}
#endif
	}
コード例 #8
0
        /// <summary>
        /// Sets the plugins.
        /// </summary>
        /// <param name="files">Files.</param>
        /// <param name="editorSettings">Editor settings.</param>
        /// <param name="settings">Settings.</param>
        static void SetPlugins(string[] files, Dictionary <string, string> editorSettings, Dictionary <BuildTarget, Dictionary <string, string> > settings)
        {
            if (files == null)
            {
                return;
            }

            foreach (string item in files)
            {
                PluginImporter pluginImporter = PluginImporter.GetAtPath(item) as PluginImporter;

                if (pluginImporter != null)
                {
                    pluginImporter.SetCompatibleWithAnyPlatform(false);
                    pluginImporter.SetCompatibleWithEditor(false);


                    if (editorSettings != null)
                    {
                        pluginImporter.SetCompatibleWithEditor(true);

                        foreach (KeyValuePair <string, string> pair in editorSettings)
                        {
                            pluginImporter.SetEditorData(pair.Key, pair.Value);
                        }
                    }

                    if (settings != null)
                    {
                        foreach (KeyValuePair <BuildTarget, Dictionary <string, string> > settingPair in settings)
                        {
                            pluginImporter.SetCompatibleWithPlatform(settingPair.Key, true);
                            if (settingPair.Value != null)
                            {
                                foreach (KeyValuePair <string, string> pair in settingPair.Value)
                                {
                                    pluginImporter.SetPlatformData(settingPair.Key, pair.Key, pair.Value);
                                }
                            }
                        }
                    }
                    else
                    {
                        foreach (BuildTarget target in Enum.GetValues(typeof(BuildTarget)))
                        {
                            pluginImporter.SetCompatibleWithPlatform(target, false);
                        }
                    }


                    pluginImporter.SaveAndReimport();

                    Debug.Log("SetPluginImportSettings Success :" + item);
                }
                else
                {
                    Debug.LogWarning("SetPluginImportSettings Faild :" + item);
                }
            }
        }
コード例 #9
0
        protected static void SetPluginBaseInfo(NativePlugin plugin, NativeBuildOptions buildOptions, PluginImporter pluginImporter)
        {
            pluginImporter.SetEditorData("PLUGIN_NAME", plugin.Name);
            pluginImporter.SetEditorData("PLUGIN_VERSION", plugin.Version);
            pluginImporter.SetEditorData("PLUGIN_BUILD_NUMBER", plugin.BuildNumber.ToString());
            BuildType buildType;

            if (buildOptions.BuildType == BuildType.Default)
            {
                buildType = EditorUserBuildSettings.development ? BuildType.Debug : BuildType.Release;
            }
            else
            {
                buildType = buildOptions.BuildType;
            }
            pluginImporter.SetEditorData("BUILD_TYPE", buildType.ToString());
        }
コード例 #10
0
ファイル: RedistMUN.cs プロジェクト: MakotoUwaya/es-unidra
        /**
         * @brief   プラグインのUnityEditor上でのターゲットプラットフォーム別設定の実行.
         * @param   plugin                  対象となるプラグイン.
         * @param   cpuType                 対象となるプラグインのサポートCPUタイプ("AnyCPU", "X86", "X86_64" のうちのどれか).
         * @param   osType                  対象となるプラグインのサポートOSタイプ("AnyOS", "OSX", "Windows", "Linux" のうちのどれか).
         */
        static void SettingPlatformWithEditor(PluginImporter plugin, string osType = "AnyOS", string cpuType = "AnyCPU")
        {
            // UnityEditorでの有効化設定
            plugin.SetCompatibleWithEditor(true);

            // CPUタイプの設定
            if (cpuType.Length > 0)
            {
                plugin.SetEditorData("CPU", cpuType);
                plugin.SetPlatformData("Editor", "CPU", cpuType);
            }

            // OSタイプの設定
            if (osType.Length > 0)
            {
                plugin.SetEditorData("OS", osType);
                plugin.SetPlatformData("Editor", "OS", osType);
            }
        }
コード例 #11
0
 private static void RemoveFromAllPlatforms(PluginImporter pluginImporter, List <BuildTarget> buildTargets)
 {
     pluginImporter.SetEditorData("CPU", null);
     AddToAnyPlatform(pluginImporter, false);
     AddAllBuildTargets(buildTargets);
     foreach (var buildTarget in buildTargets)
     {
         pluginImporter.SetCompatibleWithPlatform(buildTarget, false);
     }
 }
コード例 #12
0
        public override void PostBuild(NativePlugin plugin, NativeBuildOptions buildOptions)
        {
            base.PostBuild(plugin, buildOptions);

            string assetFile = CombinePath(
                AssetDatabase.GetAssetPath(plugin.pluginBinaryFolder),
                "OSX",
                string.Format("{0}.bundle", plugin.Name));

            PluginImporter pluginImporter = PluginImporter.GetAtPath((assetFile)) as PluginImporter;

            if (pluginImporter != null)
            {
                SetPluginBaseInfo(plugin, buildOptions, pluginImporter);

                pluginImporter.SetCompatibleWithAnyPlatform(false);
                pluginImporter.SetCompatibleWithEditor(true);
                pluginImporter.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, true);
                pluginImporter.SetEditorData("OS", "OSX");

                pluginImporter.SaveAndReimport();
            }
        }
コード例 #13
0
    private static void EnablePluginPackage(PluginPackage pluginPkg)
    {
        foreach (var kvp in pluginPkg.Plugins)
        {
            BuildTarget platform = kvp.Key;
            string      path     = kvp.Value;

            if ((Directory.Exists(path + GetDisabledPluginSuffix())) || (File.Exists(path + GetDisabledPluginSuffix())))
            {
                string basePath = GetCurrentProjectPath();
                string relPath  = path.Substring(basePath.Length + 1);

                AssetDatabase.MoveAsset(relPath + GetDisabledPluginSuffix(), relPath);
                AssetDatabase.ImportAsset(relPath, ImportAssetOptions.ForceUpdate);

                PluginImporter pi = PluginImporter.GetAtPath(relPath) as PluginImporter;
                if (pi == null)
                {
                    continue;
                }

                pi.SetCompatibleWithAnyPlatform(false);

                switch (platform)
                {
                case BuildTarget.Android:
                    pi.SetCompatibleWithPlatform(BuildTarget.Android, true);
                    pi.SetPlatformData(BuildTarget.Android, "CPU", "ARMv7");
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                    pi.SetCompatibleWithEditor(false);
                    break;

                case BuildTarget.StandaloneOSX:
                    pi.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    pi.SetPlatformData(BuildTarget.Android, "CPU", "ARMv7");
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, true);
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, true);
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, true);
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                    pi.SetCompatibleWithEditor(true);
                    pi.SetEditorData("CPU", "AnyCPU");
                    pi.SetEditorData("OS", "OSX");
                    pi.SetPlatformData("Editor", "CPU", "AnyCPU");
                    pi.SetPlatformData("Editor", "OS", "OSX");
                    break;

                case BuildTarget.StandaloneWindows:
                    pi.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    pi.SetPlatformData(BuildTarget.Android, "CPU", "ARMv7");
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, true);
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                    pi.SetCompatibleWithEditor(true);
                    pi.SetEditorData("CPU", "X86");
                    pi.SetEditorData("OS", "Windows");
                    pi.SetPlatformData("Editor", "CPU", "X86");
                    pi.SetPlatformData("Editor", "OS", "Windows");
                    break;

                case BuildTarget.StandaloneWindows64:
                    pi.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    pi.SetPlatformData(BuildTarget.Android, "CPU", "ARMv7");
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, true);
                    pi.SetCompatibleWithEditor(true);
                    pi.SetEditorData("CPU", "X86_64");
                    pi.SetEditorData("OS", "Windows");
                    pi.SetPlatformData("Editor", "CPU", "X86_64");
                    pi.SetPlatformData("Editor", "OS", "Windows");
                    break;

                default:
                    throw new ArgumentException("Attempted EnablePluginPackage() for unsupported BuildTarget: " + platform);
                }

                AssetDatabase.ImportAsset(relPath, ImportAssetOptions.ForceUpdate);
            }
        }

        AssetDatabase.Refresh();
        AssetDatabase.SaveAssets();
    }
コード例 #14
0
        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();
            }
        }
コード例 #15
0
    private static void AttemptSpatializerPluginUpdate(bool triggeredByAutoUpdate)
    {
        // We use a simplified path to update spatializer plugins:
        // If there is a new AudioPluginOculusSpatializer.dll.new, we'll rename the original one to .old, and the new one to .dll, and restart the editor

        string pluginsPath      = GetSpatializerPluginsRootPath();
        string newX86PluginPath = Path.GetFullPath(Path.Combine(pluginsPath, "x86/AudioPluginOculusSpatializer.dll.new"));
        string newX64PluginPath = Path.GetFullPath(Path.Combine(pluginsPath, "x86_64/AudioPluginOculusSpatializer.dll.new"));

        if (File.Exists(newX86PluginPath) || File.Exists(newX64PluginPath))
        {
            bool userAcceptsUpdate = false;

            if (unityRunningInBatchmode)
            {
                userAcceptsUpdate = true;
            }
            else
            {
                int dialogResult = EditorUtility.DisplayDialogComplex("Update Spatializer Plugins",
                                                                      "New spatializer plugin found. Do you want to upgrade? If you choose 'Upgrade', the old plugin will be renamed to AudioPluginOculusSpatializer.old",
                                                                      "Upgrade", "Don't upgrade", "Delete new plugin");
                if (dialogResult == 0)
                {
                    userAcceptsUpdate = true;
                }
                else if (dialogResult == 1)
                {
                    // do nothing
                }
                else if (dialogResult == 2)
                {
                    try
                    {
                        File.Delete(newX86PluginPath);
                        File.Delete(newX86PluginPath + ".meta");
                        File.Delete(newX64PluginPath);
                        File.Delete(newX64PluginPath + ".meta");
                    }
                    catch (Exception e)
                    {
                        UnityEngine.Debug.LogWarning("Exception happened when deleting new spatializer plugin: " + e.Message);
                    }
                }
            }

            if (userAcceptsUpdate)
            {
                bool   upgradeDone      = false;
                string curX86PluginPath = Path.Combine(pluginsPath, "x86/AudioPluginOculusSpatializer.dll");
                if (File.Exists(newX86PluginPath))
                {
                    RenameSpatializerPluginToOld(curX86PluginPath);
                    try
                    {
                        File.Move(newX86PluginPath, curX86PluginPath);
                        File.Move(newX86PluginPath + ".meta", curX86PluginPath + ".meta");

                        // fix the platform
                        string curX86PluginPathRel = "Assets/Oculus/Spatializer/Plugins/x86/AudioPluginOculusSpatializer.dll";
                        UnityEngine.Debug.Log("path = " + curX86PluginPathRel);
                        AssetDatabase.ImportAsset(curX86PluginPathRel, ImportAssetOptions.ForceUpdate);
                        PluginImporter pi = PluginImporter.GetAtPath(curX86PluginPathRel) as PluginImporter;
                        pi.SetCompatibleWithEditor(false);
                        pi.SetCompatibleWithAnyPlatform(false);
                        pi.SetCompatibleWithPlatform(BuildTarget.Android, false);
                        pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
#if UNITY_2017_3_OR_NEWER
                        pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
                        pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
                        pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                        pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
#endif
                        pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, true);
                        pi.SetCompatibleWithEditor(true);
                        pi.SetEditorData("CPU", "X86");
                        pi.SetEditorData("OS", "Windows");
                        pi.SetPlatformData("Editor", "CPU", "X86");
                        pi.SetPlatformData("Editor", "OS", "Windows");

                        AssetDatabase.ImportAsset(curX86PluginPathRel, ImportAssetOptions.ForceUpdate);
                        AssetDatabase.Refresh();
                        AssetDatabase.SaveAssets();

                        upgradeDone = true;
                    }
                    catch (Exception e)
                    {
                        UnityEngine.Debug.LogWarning("Unable to rename the new spatializer plugin: " + e.Message);
                    }
                }
                string curX64PluginPath = Path.Combine(pluginsPath, "x86_64/AudioPluginOculusSpatializer.dll");
                if (File.Exists(newX64PluginPath))
                {
                    RenameSpatializerPluginToOld(curX64PluginPath);
                    try
                    {
                        File.Move(newX64PluginPath, curX64PluginPath);
                        File.Move(newX64PluginPath + ".meta", curX64PluginPath + ".meta");

                        // fix the platform
                        string curX64PluginPathRel = "Assets/Oculus/Spatializer/Plugins/x86_64/AudioPluginOculusSpatializer.dll";
                        UnityEngine.Debug.Log("path = " + curX64PluginPathRel);
                        AssetDatabase.ImportAsset(curX64PluginPathRel, ImportAssetOptions.ForceUpdate);
                        PluginImporter pi = PluginImporter.GetAtPath(curX64PluginPathRel) as PluginImporter;
                        pi.SetCompatibleWithEditor(false);
                        pi.SetCompatibleWithAnyPlatform(false);
                        pi.SetCompatibleWithPlatform(BuildTarget.Android, false);
                        pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
#if UNITY_2017_3_OR_NEWER
                        pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
                        pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
                        pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                        pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
#endif
                        pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, true);
                        pi.SetCompatibleWithEditor(true);
                        pi.SetEditorData("CPU", "X86_64");
                        pi.SetEditorData("OS", "Windows");
                        pi.SetPlatformData("Editor", "CPU", "X86_64");
                        pi.SetPlatformData("Editor", "OS", "Windows");

                        AssetDatabase.ImportAsset(curX64PluginPathRel, ImportAssetOptions.ForceUpdate);
                        AssetDatabase.Refresh();
                        AssetDatabase.SaveAssets();

                        upgradeDone = true;
                    }
                    catch (Exception e)
                    {
                        UnityEngine.Debug.LogWarning("Unable to rename the new spatializer plugin: " + e.Message);
                    }
                }

                if (upgradeDone)
                {
                    if (unityRunningInBatchmode ||
                        EditorUtility.DisplayDialog("Restart Unity",
                                                    "Spatializer plugins has been upgraded."
                                                    + "\n\nPlease restart the Unity Editor to complete the update process."
#if !UNITY_2017_1_OR_NEWER
                                                    + " You may need to manually relaunch Unity if you are using Unity 5.6 and higher."
#endif
                                                    ,
                                                    "Restart",
                                                    "Not Now"))
                    {
                        RestartUnityEditor();
                    }
                }
            }
        }
    }
コード例 #16
0
ファイル: OVRPluginUpdater.cs プロジェクト: Leasteep/holoplan
    private static void EnablePluginPackage(PluginPackage pluginPkg)
    {
        foreach (var kvp in pluginPkg.Plugins)
        {
            PluginPlatform platform = kvp.Key;
            string         path     = kvp.Value;

            if ((Directory.Exists(path + GetDisabledPluginSuffix())) || (File.Exists(path + GetDisabledPluginSuffix())))
            {
                string basePath        = GetCurrentProjectPath();
                string relPath         = path.Substring(basePath.Length + 1);
                string relDisabledPath = relPath + GetDisabledPluginSuffix();

                AssetDatabase.MoveAsset(relDisabledPath, relPath);
                AssetDatabase.ImportAsset(relPath, ImportAssetOptions.ForceUpdate);

                PluginImporter pi = PluginImporter.GetAtPath(relPath) as PluginImporter;
                if (pi == null)
                {
                    continue;
                }

                // Disable support for all platforms, then conditionally enable desired support below
                pi.SetCompatibleWithEditor(false);
                pi.SetCompatibleWithAnyPlatform(false);
                pi.SetCompatibleWithPlatform(BuildTarget.Android, false);
                pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
#if UNITY_2017_3_OR_NEWER
                pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
#else
                pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
                pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
                pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
#endif

                switch (platform)
                {
                case PluginPlatform.Android:
                    pi.SetCompatibleWithPlatform(BuildTarget.Android, !unityVersionSupportsAndroidUniversal);
                    pi.SetPlatformData(BuildTarget.Android, "CPU", "ARMv7");
                    break;

                case PluginPlatform.AndroidUniversal:
                    pi.SetCompatibleWithPlatform(BuildTarget.Android, unityVersionSupportsAndroidUniversal);
                    pi.SetPlatformData(BuildTarget.Android, "CPU", "ARM64");
                    break;

                case PluginPlatform.OSXUniversal:
#if UNITY_2017_3_OR_NEWER
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, true);
#else
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, true);
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, true);
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, true);
#endif
                    pi.SetCompatibleWithEditor(true);
                    pi.SetEditorData("CPU", "AnyCPU");
                    pi.SetEditorData("OS", "OSX");
                    pi.SetPlatformData("Editor", "CPU", "AnyCPU");
                    pi.SetPlatformData("Editor", "OS", "OSX");
                    break;

                case PluginPlatform.Win:
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, true);
                    pi.SetCompatibleWithEditor(true);
                    pi.SetEditorData("CPU", "X86");
                    pi.SetEditorData("OS", "Windows");
                    pi.SetPlatformData("Editor", "CPU", "X86");
                    pi.SetPlatformData("Editor", "OS", "Windows");
                    break;

                case PluginPlatform.Win64:
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, true);
                    pi.SetCompatibleWithEditor(true);
                    pi.SetEditorData("CPU", "X86_64");
                    pi.SetEditorData("OS", "Windows");
                    pi.SetPlatformData("Editor", "CPU", "X86_64");
                    pi.SetPlatformData("Editor", "OS", "Windows");
                    break;

                default:
                    throw new ArgumentException("Attempted EnablePluginPackage() for unsupported BuildTarget: " + platform);
                }

                AssetDatabase.ImportAsset(relPath, ImportAssetOptions.ForceUpdate);
            }
        }

        AssetDatabase.Refresh();
        AssetDatabase.SaveAssets();
    }
コード例 #17
0
    private static void EnablePluginPackage(PluginPackage pluginPkg)
    {
#if UNITY_2020_1_OR_NEWER
        bool activateOpenXRPlugin = pluginPkg.Version >= minimalProductionVersionForOpenXR;
        if (activateOpenXRPlugin && !unityRunningInBatchmode)
        {
            while (true)
            {
                // display a dialog to prompt developer to confirm if they want to proceed with OpenXR backend
                int result = EditorUtility.DisplayDialogComplex("OpenXR Backend",
                                                                "OpenXR is now fully supported by Oculus. However, some of the functionalities are not supported in the baseline OpenXR spec, which would be provided in our future releases.\n\nIf you depend on the following features in your project, please click Cancel to continue using the legacy backend:\n\n  1. Advanced hand tracking features (collision capsule, input metadata, Thumb0, default handmesh)\n  2. Mixed Reality Capture on Rift\n\nNew features, such as Passthrough API, are only supported through the OpenXR backend.\n\nPlease check our release notes for more details.\n\nReminder: you can switch the legacy and OpenXR backends at any time from Oculus > Tools > OpenXR menu options.", "Use OpenXR", "Cancel", "Release Notes");
                if (result == 0)
                {
                    break;
                }
                else if (result == 1)
                {
                    activateOpenXRPlugin = false;
                    break;
                }
                else if (result == 2)
                {
                    Application.OpenURL("https://developer.oculus.com/downloads/package/unity-integration/");
                }
                else
                {
                    UnityEngine.Debug.LogWarningFormat("Unrecognized result from DisplayDialogComplex: {0}", result);
                    break;
                }
            }
        }
#else
        bool activateOpenXRPlugin = false;
#endif
        if (activateOpenXRPlugin)
        {
            UnityEngine.Debug.Log("OVRPlugin with OpenXR backend is activated by default");
            if (!unityRunningInBatchmode)
            {
                EditorUtility.DisplayDialog("OVRPlugin", "OVRPlugin with OpenXR backend will be activated by default", "Ok");
            }
        }
        else
        {
            UnityEngine.Debug.Log("OVRPlugin with LibOVR/VRAPI backend is activated by default");
            if (!unityRunningInBatchmode)
            {
                EditorUtility.DisplayDialog("OVRPlugin", "OVRPlugin with LibOVR/VRAPI backend will be activated by default", "Ok");
            }
        }

        foreach (var kvp in pluginPkg.Plugins)
        {
            PluginPlatform platform = kvp.Key;
            string         path     = kvp.Value;

            if ((Directory.Exists(path + GetDisabledPluginSuffix())) || (File.Exists(path + GetDisabledPluginSuffix())))
            {
                string basePath        = GetCurrentProjectPath();
                string relPath         = path.Substring(basePath.Length + 1);
                string relDisabledPath = relPath + GetDisabledPluginSuffix();

                AssetDatabase.MoveAsset(relDisabledPath, relPath);
                AssetDatabase.ImportAsset(relPath, ImportAssetOptions.ForceUpdate);

                PluginImporter pi = PluginImporter.GetAtPath(relPath) as PluginImporter;
                if (pi == null)
                {
                    continue;
                }

                // Disable support for all platforms, then conditionally enable desired support below
                pi.SetCompatibleWithEditor(false);
                pi.SetCompatibleWithAnyPlatform(false);
                pi.SetCompatibleWithPlatform(BuildTarget.Android, false);
                pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
                pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
                pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);

                switch (platform)
                {
                case PluginPlatform.Android:
                    pi.SetCompatibleWithPlatform(BuildTarget.Android, !unityVersionSupportsAndroidUniversal);
                    if (!unityVersionSupportsAndroidUniversal)
                    {
                        pi.SetPlatformData(BuildTarget.Android, "CPU", "ARMv7");
                    }
                    break;

                case PluginPlatform.AndroidUniversal:
                    if (!activateOpenXRPlugin)
                    {
                        pi.SetCompatibleWithPlatform(BuildTarget.Android, unityVersionSupportsAndroidUniversal);
                    }
                    break;

                case PluginPlatform.AndroidOpenXR:
                    if (activateOpenXRPlugin)
                    {
                        pi.SetCompatibleWithPlatform(BuildTarget.Android, unityVersionSupportsAndroidUniversal);
                    }
                    break;

                case PluginPlatform.OSXUniversal:
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, true);
                    pi.SetCompatibleWithEditor(true);
                    pi.SetEditorData("CPU", "AnyCPU");
                    pi.SetEditorData("OS", "OSX");
                    pi.SetPlatformData("Editor", "CPU", "AnyCPU");
                    pi.SetPlatformData("Editor", "OS", "OSX");
                    break;

                case PluginPlatform.Win:
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, true);
                    pi.SetCompatibleWithEditor(true);
                    pi.SetEditorData("CPU", "X86");
                    pi.SetEditorData("OS", "Windows");
                    pi.SetPlatformData("Editor", "CPU", "X86");
                    pi.SetPlatformData("Editor", "OS", "Windows");
                    break;

                case PluginPlatform.Win64:
                    if (!activateOpenXRPlugin)
                    {
                        pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, true);
                        pi.SetCompatibleWithEditor(true);
                        pi.SetEditorData("CPU", "X86_64");
                        pi.SetEditorData("OS", "Windows");
                        pi.SetPlatformData("Editor", "CPU", "X86_64");
                        pi.SetPlatformData("Editor", "OS", "Windows");
                    }
                    break;

                case PluginPlatform.Win64OpenXR:
                    if (activateOpenXRPlugin)
                    {
                        pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, true);
                        pi.SetCompatibleWithEditor(true);
                        pi.SetEditorData("CPU", "X86_64");
                        pi.SetEditorData("OS", "Windows");
                        pi.SetPlatformData("Editor", "CPU", "X86_64");
                        pi.SetPlatformData("Editor", "OS", "Windows");
                    }
                    break;

                default:
                    throw new ArgumentException("Attempted EnablePluginPackage() for unsupported BuildTarget: " + platform);
                }

                AssetDatabase.ImportAsset(relPath, ImportAssetOptions.ForceUpdate);
            }
        }

        AssetDatabase.Refresh();
        AssetDatabase.SaveAssets();
    }
コード例 #18
0
    private static void ActivateOVRPluginOpenXR()
    {
        if (!unityVersionSupportsAndroidUniversal)
        {
            UnityEngine.Debug.LogError("Unexpected error: Unity must support AndroidUniversal version of Oculus Utilities Plugin for accessing OpenXR");
            return;
        }

        if (OVRPluginUpdaterStub.IsInsidePackageDistribution())
        {
            UnityEngine.Debug.LogError("Unable to change plugin when using package distribution");
            return;
        }

#if !USING_XR_SDK && !REQUIRES_XR_SDK
        UnityEngine.Debug.LogError("Oculus Utilities Plugin with OpenXR only supports XR Plug-in Managmenent with Oculus XR Plugin");
        return;
#else
        List <PluginPackage> allUtilsPluginPkgs = GetAllUtilitiesPluginPackages();

        PluginPackage enabledUtilsPluginPkg = null;

        foreach (PluginPackage pluginPkg in allUtilsPluginPkgs)
        {
            if (pluginPkg.IsEnabled())
            {
                enabledUtilsPluginPkg = pluginPkg;
                break;
            }
        }

        if (enabledUtilsPluginPkg == null)
        {
            UnityEngine.Debug.LogError("Unable to Activate OVRPlugin with OpenXR: Oculus Utilities Plugin package not activated");
            return;
        }

        if (!enabledUtilsPluginPkg.IsAndroidOpenXRPresent() && !enabledUtilsPluginPkg.IsWin64OpenXRPresent())
        {
            UnityEngine.Debug.LogError("Unable to Activate OVRPlugin with OpenXR: Both AndroidOpenXR/OVRPlugin.aar or Win64OpenXR/OVRPlugin.dll does not exist");
            return;
        }

        if (enabledUtilsPluginPkg.IsAndroidOpenXREnabled() && enabledUtilsPluginPkg.IsWin64OpenXREnabled())
        {
            if (!unityRunningInBatchmode)
            {
                EditorUtility.DisplayDialog("Unable to Activate OVRPlugin with OpenXR", "Both AndroidOpenXR/OVRPlugin.aar and Win64OpenXR/OVRPlugin.dll already enabled", "Ok");
            }
            return;
        }

        if (enabledUtilsPluginPkg.Version < minimalProductionVersionForOpenXR)
        {
            if (!unityRunningInBatchmode)
            {
                bool accepted = EditorUtility.DisplayDialog("Warning",
                                                            "OVRPlugin with OpenXR backend is experimental before v31. You may expect to encounter stability issues and/or missing functionalities, " +
                                                            "including but not limited to, fixed foveated rendering / composition layer / display refresh rates / etc." +
                                                            "\n\n" +
                                                            "Also, OVRPlugin with OpenXR backend only supports XR Plug-in Managmenent with Oculus XR Plugin on Quest",
                                                            "Continue", "Cancel");

                if (!accepted)
                {
                    return;
                }
            }
        }

        if (enabledUtilsPluginPkg.IsAndroidOpenXRPresent() && !enabledUtilsPluginPkg.IsAndroidOpenXREnabled())
        {
            if (enabledUtilsPluginPkg.IsAndroidUniversalEnabled())
            {
                string         androidUniveralPluginPath     = enabledUtilsPluginPkg.Plugins[PluginPlatform.AndroidUniversal];
                string         androidUniveralPluginBasePath = GetCurrentProjectPath();
                string         androidUniveralPluginRelPath  = androidUniveralPluginPath.Substring(androidUniveralPluginBasePath.Length + 1);
                PluginImporter pi = PluginImporter.GetAtPath(androidUniveralPluginRelPath) as PluginImporter;
                if (pi != null)
                {
                    pi.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    AssetDatabase.ImportAsset(androidUniveralPluginRelPath, ImportAssetOptions.ForceUpdate);
                }
                else
                {
                    UnityEngine.Debug.LogWarning("Unable to find PluginImporter: " + androidUniveralPluginRelPath);
                }
            }

            {
                string         androidOpenXRPluginPath     = enabledUtilsPluginPkg.Plugins[PluginPlatform.AndroidOpenXR];
                string         androidOpenXRPluginBasePath = GetCurrentProjectPath();
                string         androidOpenXRPluginRelPath  = androidOpenXRPluginPath.Substring(androidOpenXRPluginBasePath.Length + 1);
                PluginImporter pi = PluginImporter.GetAtPath(androidOpenXRPluginRelPath) as PluginImporter;
                if (pi != null)
                {
                    pi.SetCompatibleWithPlatform(BuildTarget.Android, true);
                    AssetDatabase.ImportAsset(androidOpenXRPluginRelPath, ImportAssetOptions.ForceUpdate);
                }
                else
                {
                    UnityEngine.Debug.LogWarning("Unable to find PluginImporter: " + androidOpenXRPluginRelPath);
                }
            }
        }


        bool win64PluginUpdated = false;

        if (enabledUtilsPluginPkg.IsWin64OpenXRPresent() && !enabledUtilsPluginPkg.IsWin64OpenXREnabled())
        {
            if (enabledUtilsPluginPkg.IsWin64Enabled())
            {
                string         win64PluginPath     = enabledUtilsPluginPkg.Plugins[PluginPlatform.Win64];
                string         win64PluginBasePath = GetCurrentProjectPath();
                string         win64PluginRelPath  = win64PluginPath.Substring(win64PluginBasePath.Length + 1);
                PluginImporter pi = PluginImporter.GetAtPath(win64PluginRelPath) as PluginImporter;
                if (pi != null)
                {
                    pi.ClearSettings();
                    pi.SetCompatibleWithEditor(false);
                    pi.SetCompatibleWithAnyPlatform(false);
                    AssetDatabase.ImportAsset(win64PluginRelPath, ImportAssetOptions.ForceUpdate);
                }
                else
                {
                    UnityEngine.Debug.LogWarning("Unable to find PluginImporter: " + win64PluginRelPath);
                }
            }

            {
                string         win64OpenXRPluginPath     = enabledUtilsPluginPkg.Plugins[PluginPlatform.Win64OpenXR];
                string         win64OpenXRPluginBasePath = GetCurrentProjectPath();
                string         win64OpenXRPluginRelPath  = win64OpenXRPluginPath.Substring(win64OpenXRPluginBasePath.Length + 1);
                PluginImporter pi = PluginImporter.GetAtPath(win64OpenXRPluginRelPath) as PluginImporter;
                if (pi != null)
                {
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, true);
                    pi.SetCompatibleWithEditor(true);
                    pi.SetEditorData("CPU", "X86_64");
                    pi.SetEditorData("OS", "Windows");
                    pi.SetPlatformData("Editor", "CPU", "X86_64");
                    pi.SetPlatformData("Editor", "OS", "Windows");
                    AssetDatabase.ImportAsset(win64OpenXRPluginRelPath, ImportAssetOptions.ForceUpdate);
                }
                else
                {
                    UnityEngine.Debug.LogWarning("Unable to find PluginImporter: " + win64OpenXRPluginRelPath);
                }
            }

            win64PluginUpdated = true;
        }

        AssetDatabase.Refresh();
        AssetDatabase.SaveAssets();

        if (!unityRunningInBatchmode)
        {
            EditorUtility.DisplayDialog("Activate OVRPlugin with OpenXR", "Oculus Utilities Plugin with OpenXR has been enabled on Android", "Ok");
            if (win64PluginUpdated && EditorUtility.DisplayDialog("Restart Unity",
                                                                  "Win64 plugin updated. Do you want to restart Unity editor?",
                                                                  "Restart",
                                                                  "Not Now"))
            {
                RestartUnityEditor();
            }
        }
#endif // !USING_XR_SDK
    }
コード例 #19
0
    private static void RestoreStandardOVRPlugin()
    {
        if (!unityVersionSupportsAndroidUniversal)         // sanity check
        {
            UnityEngine.Debug.LogError("Unexpected error: Unity must support AndroidUniversal version of Oculus Utilities Plugin for accessing OpenXR");
            return;
        }

        if (OVRPluginUpdaterStub.IsInsidePackageDistribution())
        {
            UnityEngine.Debug.LogError("Unable to change plugin when using package distribution");
            return;
        }

        List <PluginPackage> allUtilsPluginPkgs = GetAllUtilitiesPluginPackages();

        PluginPackage enabledUtilsPluginPkg = null;

        foreach (PluginPackage pluginPkg in allUtilsPluginPkgs)
        {
            if (pluginPkg.IsEnabled())
            {
                enabledUtilsPluginPkg = pluginPkg;
                break;
            }
        }

        if (enabledUtilsPluginPkg == null)
        {
            UnityEngine.Debug.LogError("Unable to Restore Standard Oculus Utilities Plugin: Oculus Utilities Plugin package not activated");
            return;
        }

        if (!enabledUtilsPluginPkg.IsAndroidUniversalPresent() && !enabledUtilsPluginPkg.IsWin64Present())
        {
            UnityEngine.Debug.LogError("Unable to Restore Standard Oculus Utilities Plugin: Both AndroidOpenXR/OVRPlugin.aar and Win64/OVRPlugin.dll does not exist");
            return;
        }

        if (enabledUtilsPluginPkg.IsAndroidUniversalEnabled() && enabledUtilsPluginPkg.IsWin64Enabled())
        {
            if (!unityRunningInBatchmode)
            {
                EditorUtility.DisplayDialog("Unable to Restore Standard Oculus Utilities Plugin", "Both AndroidUniversal/OVRPlugin.aar and Win64/OVRPlugin.dll already enabled", "Ok");
            }
            return;
        }

        if (enabledUtilsPluginPkg.IsAndroidUniversalPresent() && !enabledUtilsPluginPkg.IsAndroidUniversalEnabled())
        {
            if (enabledUtilsPluginPkg.IsAndroidOpenXREnabled())
            {
                string         androidOpenXRPluginPath     = enabledUtilsPluginPkg.Plugins[PluginPlatform.AndroidOpenXR];
                string         androidOpenXRPluginBasePath = GetCurrentProjectPath();
                string         androidOpenXRPluginRelPath  = androidOpenXRPluginPath.Substring(androidOpenXRPluginBasePath.Length + 1);
                PluginImporter pi = PluginImporter.GetAtPath(androidOpenXRPluginRelPath) as PluginImporter;
                if (pi != null)
                {
                    pi.SetCompatibleWithPlatform(BuildTarget.Android, false);
                    AssetDatabase.ImportAsset(androidOpenXRPluginRelPath, ImportAssetOptions.ForceUpdate);
                }
                else
                {
                    UnityEngine.Debug.LogWarning("Unable to find PluginImporter: " + androidOpenXRPluginRelPath);
                }
            }

            {
                string         androidUniveralPluginPath     = enabledUtilsPluginPkg.Plugins[PluginPlatform.AndroidUniversal];
                string         androidUniveralPluginBasePath = GetCurrentProjectPath();
                string         androidUniveralPluginRelPath  = androidUniveralPluginPath.Substring(androidUniveralPluginBasePath.Length + 1);
                PluginImporter pi = PluginImporter.GetAtPath(androidUniveralPluginRelPath) as PluginImporter;
                if (pi != null)
                {
                    pi.SetCompatibleWithPlatform(BuildTarget.Android, true);
                    AssetDatabase.ImportAsset(androidUniveralPluginRelPath, ImportAssetOptions.ForceUpdate);
                }
                else
                {
                    UnityEngine.Debug.LogWarning("Unable to find PluginImporter: " + androidUniveralPluginRelPath);
                }
            }
        }

        bool win64PluginUpdated = false;

        if (enabledUtilsPluginPkg.IsWin64Present() && !enabledUtilsPluginPkg.IsWin64Enabled())
        {
            if (enabledUtilsPluginPkg.IsWin64OpenXREnabled())
            {
                string         win64OpenXRPluginPath     = enabledUtilsPluginPkg.Plugins[PluginPlatform.Win64OpenXR];
                string         win64OpenXRPluginBasePath = GetCurrentProjectPath();
                string         win64OpenXRPluginRelPath  = win64OpenXRPluginPath.Substring(win64OpenXRPluginBasePath.Length + 1);
                PluginImporter pi = PluginImporter.GetAtPath(win64OpenXRPluginRelPath) as PluginImporter;
                if (pi != null)
                {
                    pi.ClearSettings();
                    pi.SetCompatibleWithEditor(false);
                    pi.SetCompatibleWithAnyPlatform(false);
                    AssetDatabase.ImportAsset(win64OpenXRPluginRelPath, ImportAssetOptions.ForceUpdate);
                }
                else
                {
                    UnityEngine.Debug.LogWarning("Unable to find PluginImporter: " + win64OpenXRPluginRelPath);
                }
            }

            {
                string         win64PluginPath     = enabledUtilsPluginPkg.Plugins[PluginPlatform.Win64];
                string         win64PluginBasePath = GetCurrentProjectPath();
                string         win64PluginRelPath  = win64PluginPath.Substring(win64PluginBasePath.Length + 1);
                PluginImporter pi = PluginImporter.GetAtPath(win64PluginRelPath) as PluginImporter;
                if (pi != null)
                {
                    pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, true);
                    pi.SetCompatibleWithEditor(true);
                    pi.SetEditorData("CPU", "X86_64");
                    pi.SetEditorData("OS", "Windows");
                    pi.SetPlatformData("Editor", "CPU", "X86_64");
                    pi.SetPlatformData("Editor", "OS", "Windows");
                    AssetDatabase.ImportAsset(win64PluginRelPath, ImportAssetOptions.ForceUpdate);
                }
                else
                {
                    UnityEngine.Debug.LogWarning("Unable to find PluginImporter: " + win64PluginRelPath);
                }
            }

            win64PluginUpdated = true;
        }

        AssetDatabase.Refresh();
        AssetDatabase.SaveAssets();

        if (!unityRunningInBatchmode)
        {
            EditorUtility.DisplayDialog("Restore Standard OVRPlugin", "Standard version of Oculus Utilities Plugin has been enabled on Android", "Ok");
            if (win64PluginUpdated && EditorUtility.DisplayDialog("Restart Unity",
                                                                  "Win64 plugin updated. Do you want to restart Unity editor?",
                                                                  "Restart",
                                                                  "Not Now"))
            {
                RestartUnityEditor();
            }
        }
    }