/// <summary>
        /// Checks critical project settings and suggests changes to optimize performance via logged warnings
        /// </summary>
        private static void LogConfigurationWarnings()
        {
            if (!PlayerSettings.virtualRealitySupported)
            {
                Debug.LogWarning("<b>Virtual reality supported</b> not enabled. Check <i>XR Settings</i> under <i>Player Settings</i>");
            }

            if (!MixedRealityOptimizeUtils.IsSinglePassInstanced())
            {
                Debug.LogWarning("XR stereo rendering mode not set to <b>Single Pass Instanced</b>. See <i>Mixed Reality Toolkit</i> > <i>Utilities</i> > <i>Optimize Window</i> tool for more information to improve performance");
            }

            // If targeting Windows Mixed Reality platform
            if (MixedRealityOptimizeUtils.IsBuildTargetUWP())
            {
                if (!MixedRealityOptimizeUtils.IsDepthBufferSharingEnabled())
                {
                    // If depth buffer sharing not enabled, advise to enable setting
                    Debug.LogWarning("<b>Depth Buffer Sharing</b> is not enabled to improve hologram stabilization. See <i>Mixed Reality Toolkit</i> > <i>Utilities</i> > <i>Optimize Window</i> tool for more information to improve performance");
                }

                if (!MixedRealityOptimizeUtils.IsWMRDepthBufferFormat16bit())
                {
                    // If depth format is 24-bit, advise to consider 16-bit for performance.
                    Debug.LogWarning("<b>Depth Buffer Sharing</b> has 24-bit depth format selected. Consider using 16-bit for performance. See <i>Mixed Reality Toolkit</i> > <i>Utilities</i> > <i>Optimize Window</i> tool for more information to improve performance");
                }

                if (!AudioSettings.GetSpatializerPluginName().Equals(MSFT_AudioSpatializerPlugin))
                {
                    // If using UWP, developers should use the Microsoft Audio Spatilizer plugin
                    Debug.LogWarning("<b>Audio Spatializer Plugin</b> not currently set to <i>" + MSFT_AudioSpatializerPlugin + "</i>. Switch to <i>" + MSFT_AudioSpatializerPlugin + "</i> under <i>Project Settings</i> > <i>Audio</i> > <i>Spatializer Plugin</i>");
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Saves the specified spatializer to the audio settings.
        /// </summary>
        public static void SaveSettings(string spatializer)
        {
            if ((spatializer != null) &&
                !InstalledSpatializers.Contains(spatializer))
            {
                Debug.LogError($"{spatializer} is not an installed spatializer.");
                return;
            }

            if (spatializer == null)
            {
                Debug.LogWarning("No spatializer was specified. The application will not support Spatial Sound.");
            }

            SerializedObject   audioMgrSettings  = MixedRealityOptimizeUtils.GetSettingsObject("AudioManager");
            SerializedProperty spatializerPlugin = audioMgrSettings.FindProperty("m_SpatializerPlugin");

            if (spatializerPlugin == null)
            {
                Debug.LogError("Unable to save the spatializer settings. The field could not be located into the Audio Manager settings object.");
                return;
            }

            AudioSettings.SetSpatializerPluginName(spatializer);
            spatializerPlugin.stringValue = spatializer;
            audioMgrSettings.ApplyModifiedProperties();

            // Cache the count of installed spatializers
            MixedRealityProjectPreferences.AudioSpatializerCount = InstalledSpatializers.Length;
        }
        private void RenderConfigurations()
        {
            EditorGUILayout.LabelField("Enabled options will be applied to the project. Disabled items are already properly configured.");
            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Project Settings", EditorStyles.boldLabel);
            RenderToggle(MRConfig.ForceTextSerialization, "Enable Force Text Serialization");
            RenderToggle(MRConfig.VisibleMetaFiles, "Enable Visible meta files");
            if (!MixedRealityOptimizeUtils.IsBuildTargetAndroid() && !MixedRealityOptimizeUtils.IsBuildTargetIOS())
            {
                RenderToggle(MRConfig.VirtualRealitySupported, "Enable VR Supported");
            }
            RenderToggle(MRConfig.SinglePassInstancing, "Set Single Pass Instanced rendering path");
            RenderToggle(MRConfig.SpatialAwarenessLayer, "Set Default Spatial Awareness Layer");
            RenderToggle(MRConfig.EnableMSBuildForUnity, "Enable MSBuild for Unity");
            EditorGUILayout.Space();

            if (MixedRealityOptimizeUtils.IsBuildTargetUWP())
            {
                EditorGUILayout.LabelField("UWP Capabilities", EditorStyles.boldLabel);

                RenderToggle(MRConfig.MicrophoneCapability, "Enable Microphone Capability");
                RenderToggle(MRConfig.InternetClientCapability, "Enable Internet Client Capability");
                RenderToggle(MRConfig.SpatialPerceptionCapability, "Enable Spatial Perception Capability");
#if UNITY_2019_3_OR_NEWER
                RenderToggle(MRConfig.EyeTrackingCapability, "Enable Eye Gaze Input Capability");
#endif
            }
            else
            {
                trackToggles[MRConfig.MicrophoneCapability]        = false;
                trackToggles[MRConfig.InternetClientCapability]    = false;
                trackToggles[MRConfig.SpatialPerceptionCapability] = false;
#if UNITY_2019_3_OR_NEWER
                trackToggles[MRConfig.EyeTrackingCapability] = false;
#endif
            }

            if (MixedRealityOptimizeUtils.IsBuildTargetAndroid())
            {
                EditorGUILayout.LabelField("Android Settings", EditorStyles.boldLabel);
                RenderToggle(MRConfig.AndroidMultiThreadedRendering, "Disable Multi-Threaded Rendering");
                RenderToggle(MRConfig.AndroidMinSdkVersion, "Set Minimum API Level");
            }

            if (MixedRealityOptimizeUtils.IsBuildTargetIOS())
            {
                EditorGUILayout.LabelField("iOS Settings", EditorStyles.boldLabel);
                RenderToggle(MRConfig.IOSMinOSVersion, "Set Required OS Version");
                RenderToggle(MRConfig.IOSArchitecture, "Set Required Architecture");
                RenderToggle(MRConfig.IOSCameraUsageDescription, "Set Camera Usage Descriptions");
            }
        }
        private void RenderConfigurations()
        {
            EditorGUILayout.LabelField("Enabled options will be applied to the project. Disabled items are already properly configured.");
            EditorGUILayout.Space();

            using (var scrollView = new EditorGUILayout.ScrollViewScope(scrollPosition))
            {
                scrollPosition = scrollView.scrollPosition;
                EditorGUILayout.LabelField("Project Settings", EditorStyles.boldLabel);
                RenderToggle(MRConfig.ForceTextSerialization, "Force text asset serialization");
                RenderToggle(MRConfig.VisibleMetaFiles, "Enable visible meta files");
                if (!MixedRealityOptimizeUtils.IsBuildTargetAndroid() && !MixedRealityOptimizeUtils.IsBuildTargetIOS() && XRSettingsUtilities.IsLegacyXRActive)
                {
#if UNITY_2019_3_OR_NEWER
                    RenderToggle(MRConfig.VirtualRealitySupported, "Enable legacy XR");
#else
                    RenderToggle(MRConfig.VirtualRealitySupported, "Enable VR supported");
#endif // UNITY_2019_3_OR_NEWER
                }
#if UNITY_2019_3_OR_NEWER
                RenderToggle(MRConfig.OptimalRenderingPath, "Set Single Pass Instanced rendering path (legacy XR API)");
#else
#if UNITY_ANDROID
                RenderToggle(MRConfig.OptimalRenderingPath, "Set Single Pass Stereo rendering path");
#else
                RenderToggle(MRConfig.OptimalRenderingPath, "Set Single Pass Instanced rendering path");
#endif
#endif // UNITY_2019_3_OR_NEWER
                RenderToggle(MRConfig.SpatialAwarenessLayer, "Set default Spatial Awareness layer");
                PromptForAudioSpatializer();
                EditorGUILayout.Space();

                if (MixedRealityOptimizeUtils.IsBuildTargetUWP())
                {
#if !UNITY_2019_3_OR_NEWER
                    EditorGUILayout.LabelField("MSBuild for Unity Support", EditorStyles.boldLabel);
                    EditorGUILayout.HelpBox("Enable this for additional HoloLens 2 features, like hand joint remoting and depth LSR mode.", MessageType.Info);
                    RenderToggle(MRConfig.EnableMSBuildForUnity, "Enable MSBuild for Unity");
                    EditorGUILayout.Space();
#endif // !UNITY_2019_3_OR_NEWER


                    EditorGUILayout.LabelField("UWP Capabilities", EditorStyles.boldLabel);
                    RenderToggle(MRConfig.MicrophoneCapability, "Enable Microphone Capability");
                    RenderToggle(MRConfig.InternetClientCapability, "Enable Internet Client Capability");
                    RenderToggle(MRConfig.SpatialPerceptionCapability, "Enable Spatial Perception Capability");
#if UNITY_2019_3_OR_NEWER
                    RenderToggle(MRConfig.EyeTrackingCapability, "Enable Eye Gaze Input Capability");
#endif // UNITY_2019_3_OR_NEWER
                }
                else
                {
                    trackToggles[MRConfig.MicrophoneCapability]        = false;
                    trackToggles[MRConfig.InternetClientCapability]    = false;
                    trackToggles[MRConfig.SpatialPerceptionCapability] = false;
#if UNITY_2019_3_OR_NEWER
                    trackToggles[MRConfig.EyeTrackingCapability] = false;
#endif // UNITY_2019_3_OR_NEWER
                }

                if (MixedRealityOptimizeUtils.IsBuildTargetAndroid())
                {
                    EditorGUILayout.LabelField("Android Settings", EditorStyles.boldLabel);
                    RenderToggle(MRConfig.AndroidMultiThreadedRendering, "Disable Multi-Threaded Rendering");
                    RenderToggle(MRConfig.AndroidMinSdkVersion, "Set Minimum API Level");
                }

                if (MixedRealityOptimizeUtils.IsBuildTargetIOS())
                {
                    EditorGUILayout.LabelField("iOS Settings", EditorStyles.boldLabel);
                    RenderToggle(MRConfig.IOSMinOSVersion, "Set Required OS Version");
                    RenderToggle(MRConfig.IOSArchitecture, "Set Required Architecture");
                    RenderToggle(MRConfig.IOSCameraUsageDescription, "Set Camera Usage Descriptions");
                }
            }
        }
Exemple #5
0
 private static bool GetCapability(PlayerSettings.WSACapability capability)
 {
     return(MixedRealityOptimizeUtils.IsBuildTargetUWP() ? PlayerSettings.WSA.GetCapability(capability) : true);
 }
        private void RenderConfigurations()
        {
            EditorGUILayout.LabelField("Enabled options will be applied to the project. Disabled items are already properly configured.");
            EditorGUILayout.Space();

            using (var scrollView = new EditorGUILayout.ScrollViewScope(scrollPosition))
            {
                scrollPosition = scrollView.scrollPosition;
                EditorGUILayout.LabelField("Project Settings", EditorStyles.boldLabel);
                RenderToggle(MRConfig.ForceTextSerialization, "Force text asset serialization");
                RenderToggle(MRConfig.VisibleMetaFiles, "Enable visible meta files");
                if (!MixedRealityOptimizeUtils.IsBuildTargetAndroid() && !MixedRealityOptimizeUtils.IsBuildTargetIOS() && XRSettingsUtilities.IsLegacyXRActive)
                {
#if !UNITY_2019_3_OR_NEWER
                    RenderToggle(MRConfig.VirtualRealitySupported, "Enable VR supported");
#endif // !UNITY_2019_3_OR_NEWER
                }
#if UNITY_2019_3_OR_NEWER
                RenderToggle(MRConfig.OptimalRenderingPath, "Set Single Pass Instanced rendering path (legacy XR API)");
#else
#if UNITY_ANDROID
                RenderToggle(MRConfig.OptimalRenderingPath, "Set Single Pass Stereo rendering path");
#else
                RenderToggle(MRConfig.OptimalRenderingPath, "Set Single Pass Instanced rendering path");
#endif
#endif // UNITY_2019_3_OR_NEWER
                RenderToggle(MRConfig.SpatialAwarenessLayer, "Set default Spatial Awareness layer");

#if UNITY_2019_3_OR_NEWER
                RenderToggle(MRConfig.NewInputSystem, "Enable old input system for input simulation (won't disable new input system)");
#endif // UNITY_2019_3_OR_NEWER

                PromptForAudioSpatializer();
                EditorGUILayout.Space();

                if (MixedRealityOptimizeUtils.IsBuildTargetUWP())
                {
                    EditorGUILayout.LabelField("UWP Capabilities", EditorStyles.boldLabel);
                    RenderToggle(MRConfig.MicrophoneCapability, "Enable Microphone Capability");
                    RenderToggle(MRConfig.InternetClientCapability, "Enable Internet Client Capability");
                    RenderToggle(MRConfig.SpatialPerceptionCapability, "Enable Spatial Perception Capability");
#if UNITY_2019_3_OR_NEWER
                    RenderToggle(MRConfig.EyeTrackingCapability, "Enable Eye Gaze Input Capability");
                    RenderToggle(MRConfig.GraphicsJobWorkaround, "Avoid Unity 'PlayerSettings.graphicsJob' crash");
#endif // UNITY_2019_3_OR_NEWER
                }
                else
                {
                    trackToggles[MRConfig.MicrophoneCapability]        = false;
                    trackToggles[MRConfig.InternetClientCapability]    = false;
                    trackToggles[MRConfig.SpatialPerceptionCapability] = false;
#if UNITY_2019_3_OR_NEWER
                    trackToggles[MRConfig.EyeTrackingCapability] = false;
                    trackToggles[MRConfig.GraphicsJobWorkaround] = false;
#endif // UNITY_2019_3_OR_NEWER
                }

                if (MixedRealityOptimizeUtils.IsBuildTargetAndroid())
                {
                    EditorGUILayout.LabelField("Android Settings", EditorStyles.boldLabel);
                    RenderToggle(MRConfig.AndroidMultiThreadedRendering, "Disable Multi-Threaded Rendering");
                    RenderToggle(MRConfig.AndroidMinSdkVersion, "Set Minimum API Level");
                }

                if (MixedRealityOptimizeUtils.IsBuildTargetIOS())
                {
                    EditorGUILayout.LabelField("iOS Settings", EditorStyles.boldLabel);
                    RenderToggle(MRConfig.IOSMinOSVersion, "Set Required OS Version");
                    RenderToggle(MRConfig.IOSArchitecture, "Set Required Architecture");
                    RenderToggle(MRConfig.IOSCameraUsageDescription, "Set Camera Usage Descriptions");
                }
            }
        }