GetDisplayIndices() public static method

public static GetDisplayIndices ( ) : int[]
return int[]
Beispiel #1
0
        private void AllRootCanvases()
        {
            if (PlayerSettings.virtualRealitySupported && (m_RenderMode.enumValueIndex == (int)RenderMode.ScreenSpaceOverlay))
            {
                EditorGUILayout.HelpBox("Using a render mode of ScreenSpaceOverlay while VR is enabled will cause the Canvas to continue to incur a rendering cost, even though the Canvas will not be visible in VR.", MessageType.Warning);
            }

            EditorGUILayout.PropertyField(m_RenderMode);

            m_OverlayMode.target = m_RenderMode.intValue == 0;
            m_CameraMode.target  = m_RenderMode.intValue == 1;
            m_WorldMode.target   = m_RenderMode.intValue == 2;

            EditorGUI.indentLevel++;
            if (EditorGUILayout.BeginFadeGroup(m_OverlayMode.faded))
            {
                EditorGUILayout.PropertyField(m_PixelPerfect);
                EditorGUILayout.PropertyField(m_SortingOrder, Styles.sortingOrder);
                GUIContent[] displayNames = DisplayUtility.GetDisplayNames();
                EditorGUILayout.IntPopup(m_TargetDisplay, displayNames, DisplayUtility.GetDisplayIndices(), Styles.targetDisplay);
            }
            EditorGUILayout.EndFadeGroup();

            if (EditorGUILayout.BeginFadeGroup(m_CameraMode.faded))
            {
                EditorGUILayout.PropertyField(m_PixelPerfect);
                EditorGUILayout.PropertyField(m_Camera, Styles.renderCamera);

                if (m_Camera.objectReferenceValue != null)
                {
                    EditorGUILayout.PropertyField(m_PlaneDistance);
                }

                EditorGUILayout.Space();

                if (m_Camera.objectReferenceValue != null)
                {
                    EditorGUILayout.SortingLayerField(Styles.m_SortingLayerStyle, m_SortingLayerID, EditorStyles.popup, EditorStyles.label);
                }
                EditorGUILayout.PropertyField(m_SortingOrder, Styles.m_SortingOrderStyle);

                if (m_Camera.objectReferenceValue == null)
                {
                    EditorGUILayout.HelpBox("Screen Space - A canvas with no specified camera acts like a Overlay Canvas." +
                                            " Please assign a camera to it in the 'Render Camera' field.", MessageType.Warning);
                }
            }
            EditorGUILayout.EndFadeGroup();

            if (EditorGUILayout.BeginFadeGroup(m_WorldMode.faded))
            {
                EditorGUILayout.PropertyField(m_Camera, Styles.eventCamera);
                EditorGUILayout.Space();
                EditorGUILayout.SortingLayerField(Styles.m_SortingLayerStyle, m_SortingLayerID, EditorStyles.popup);
                EditorGUILayout.PropertyField(m_SortingOrder, Styles.m_SortingOrderStyle);
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUI.indentLevel--;
        }
        private void AllRootCanvases()
        {
            EditorGUILayout.PropertyField(m_RenderMode);

            m_OverlayMode.target = m_RenderMode.intValue == 0;
            m_CameraMode.target = m_RenderMode.intValue == 1;
            m_WorldMode.target = m_RenderMode.intValue == 2;

            EditorGUI.indentLevel++;
            if (EditorGUILayout.BeginFadeGroup(m_OverlayMode.faded))
            {
                EditorGUILayout.PropertyField(m_PixelPerfect);
                EditorGUILayout.PropertyField(m_SortingOrder, Styles.sortingOrder);
                GUIContent[] displayNames = DisplayUtility.GetDisplayNames();
                EditorGUILayout.IntPopup(m_TargetDisplay, displayNames, DisplayUtility.GetDisplayIndices(), Styles.targetDisplay);
            }
            EditorGUILayout.EndFadeGroup();

            if (EditorGUILayout.BeginFadeGroup(m_CameraMode.faded))
            {
                EditorGUILayout.PropertyField(m_PixelPerfect);
                EditorGUILayout.PropertyField(m_Camera, Styles.renderCamera);

                if (m_Camera.objectReferenceValue != null)
                    EditorGUILayout.PropertyField(m_PlaneDistance);

                EditorGUILayout.Space();

                if (m_Camera.objectReferenceValue != null)
                    EditorGUILayout.SortingLayerField(Styles.m_SortingLayerStyle, m_SortingLayerID, EditorStyles.popup, EditorStyles.label);
                EditorGUILayout.PropertyField(m_SortingOrder, Styles.m_SortingOrderStyle);

                if (m_Camera.objectReferenceValue == null)
                    EditorGUILayout.HelpBox("Screen Space - A canvas with no specified camera acts like a Overlay Canvas." +
                        " Please assign a camera to it in the 'Render Camera' field.", MessageType.Warning);
            }
            EditorGUILayout.EndFadeGroup();

            if (EditorGUILayout.BeginFadeGroup(m_WorldMode.faded))
            {
                EditorGUILayout.PropertyField(m_Camera, Styles.eventCamera);
                EditorGUILayout.Space();
                EditorGUILayout.SortingLayerField(Styles.m_SortingLayerStyle, m_SortingLayerID, EditorStyles.popup);
                EditorGUILayout.PropertyField(m_SortingOrder, Styles.m_SortingOrderStyle);
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUI.indentLevel--;
        }
Beispiel #3
0
 public void DrawMultiDisplay()
 {
     if (ModuleManager.ShouldShowMultiDisplayOption())
     {
         int prevDisplay = targetDisplay.intValue;
         EditorGUILayout.IntPopup(targetDisplay, DisplayUtility.GetDisplayNames(), DisplayUtility.GetDisplayIndices(), EditorGUIUtility.TempContent("Target Display"));
         if (prevDisplay != targetDisplay.intValue)
         {
             GameView.RepaintAll();
         }
     }
 }
Beispiel #4
0
 public override void OnInspectorGUI()
 {
     base.serializedObject.Update();
     if (this.m_AllRoot)
     {
         EditorGUILayout.PropertyField(this.m_RenderMode, new GUILayoutOption[0]);
         this.m_OverlayMode.target = this.m_RenderMode.intValue == 0;
         this.m_CameraMode.target  = this.m_RenderMode.intValue == 1;
         this.m_WorldMode.target   = this.m_RenderMode.intValue == 2;
         EditorGUI.indentLevel++;
         if (EditorGUILayout.BeginFadeGroup(this.m_OverlayMode.faded))
         {
             EditorGUILayout.PropertyField(this.m_PixelPerfect, new GUILayoutOption[0]);
             EditorGUILayout.PropertyField(this.m_SortingOrder, Styles.sortingOrder, new GUILayoutOption[0]);
             GUIContent[] displayNames = DisplayUtility.GetDisplayNames();
             EditorGUILayout.IntPopup(this.m_TargetDisplay, displayNames, DisplayUtility.GetDisplayIndices(), Styles.targetDisplay, new GUILayoutOption[0]);
         }
         EditorGUILayout.EndFadeGroup();
         if (EditorGUILayout.BeginFadeGroup(this.m_CameraMode.faded))
         {
             EditorGUILayout.PropertyField(this.m_PixelPerfect, new GUILayoutOption[0]);
             EditorGUILayout.PropertyField(this.m_Camera, Styles.renderCamera, new GUILayoutOption[0]);
             if (this.m_Camera.objectReferenceValue != null)
             {
                 EditorGUILayout.PropertyField(this.m_PlaneDistance, new GUILayoutOption[0]);
             }
             EditorGUILayout.Space();
             if (this.m_Camera.objectReferenceValue != null)
             {
                 EditorGUILayout.SortingLayerField(Styles.m_SortingLayerStyle, this.m_SortingLayerID, EditorStyles.popup, EditorStyles.label);
             }
             EditorGUILayout.PropertyField(this.m_SortingOrder, Styles.m_SortingOrderStyle, new GUILayoutOption[0]);
             if (this.m_Camera.objectReferenceValue == null)
             {
                 EditorGUILayout.HelpBox("Screen Space - A canvas with no specified camera acts like a Overlay Canvas. Please assign a camera to it in the 'Render Camera' field.", MessageType.Warning);
             }
         }
         EditorGUILayout.EndFadeGroup();
         if (EditorGUILayout.BeginFadeGroup(this.m_WorldMode.faded))
         {
             EditorGUILayout.PropertyField(this.m_Camera, Styles.eventCamera, new GUILayoutOption[0]);
             EditorGUILayout.Space();
             EditorGUILayout.SortingLayerField(Styles.m_SortingLayerStyle, this.m_SortingLayerID, EditorStyles.popup);
             EditorGUILayout.PropertyField(this.m_SortingOrder, Styles.m_SortingOrderStyle, new GUILayoutOption[0]);
         }
         EditorGUILayout.EndFadeGroup();
         EditorGUI.indentLevel--;
     }
     else if (this.m_AllNested)
     {
         EditorGUI.BeginChangeCheck();
         this.pixelPerfect = (PixelPerfect)EditorGUILayout.EnumPopup("Pixel Perfect", this.pixelPerfect, new GUILayoutOption[0]);
         if (EditorGUI.EndChangeCheck())
         {
             if (this.pixelPerfect == PixelPerfect.Inherit)
             {
                 this.m_PixelPerfectOverride.boolValue = false;
             }
             else if (this.pixelPerfect == PixelPerfect.Off)
             {
                 this.m_PixelPerfectOverride.boolValue = true;
                 this.m_PixelPerfect.boolValue         = false;
             }
             else
             {
                 this.m_PixelPerfectOverride.boolValue = true;
                 this.m_PixelPerfect.boolValue         = true;
             }
         }
         EditorGUI.BeginChangeCheck();
         EditorGUILayout.PropertyField(this.m_OverrideSorting, new GUILayoutOption[0]);
         if (EditorGUI.EndChangeCheck())
         {
             ((Canvas)base.serializedObject.targetObject).overrideSorting = this.m_OverrideSorting.boolValue;
             this.m_SortingOverride.target = this.m_OverrideSorting.boolValue;
         }
         if (EditorGUILayout.BeginFadeGroup(this.m_SortingOverride.faded))
         {
             GUIContent label = null;
             if (this.m_AllOverlay)
             {
                 label = Styles.sortingOrder;
             }
             else if (this.m_NoneOverlay)
             {
                 label = Styles.m_SortingOrderStyle;
                 EditorGUILayout.SortingLayerField(Styles.m_SortingLayerStyle, this.m_SortingLayerID, EditorStyles.popup);
             }
             if (label != null)
             {
                 EditorGUI.BeginChangeCheck();
                 EditorGUILayout.PropertyField(this.m_SortingOrder, label, new GUILayoutOption[0]);
                 if (EditorGUI.EndChangeCheck())
                 {
                     ((Canvas)base.serializedObject.targetObject).sortingOrder = this.m_SortingOrder.intValue;
                 }
             }
         }
         EditorGUILayout.EndFadeGroup();
     }
     else
     {
         GUILayout.Label(Styles.s_RootAndNestedMessage, EditorStyles.helpBox, new GUILayoutOption[0]);
     }
     base.serializedObject.ApplyModifiedProperties();
 }
        public override void OnInspectorGUI()
        {
            this.serializedObject.Update();
            Camera target = (Camera)this.target;

            this.m_ShowBGColorOptions.target  = !this.m_ClearFlags.hasMultipleDifferentValues && (target.clearFlags == CameraClearFlags.Color || target.clearFlags == CameraClearFlags.Skybox);
            this.m_ShowOrthoOptions.target    = !this.m_Orthographic.hasMultipleDifferentValues && target.orthographic;
            this.m_ShowTargetEyeOption.target = this.m_TargetEye.intValue != 3 || PlayerSettings.virtualRealitySupported || PlayerSettings.stereoscopic3D;
            EditorGUILayout.PropertyField(this.m_ClearFlags);
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowBGColorOptions.faded))
            {
                EditorGUILayout.PropertyField(this.m_BackgroundColor, new GUIContent("Background", "Camera clears the screen to this color before rendering."), new GUILayoutOption[0]);
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUILayout.PropertyField(this.m_CullingMask);
            EditorGUILayout.Space();
            CameraEditor.ProjectionType projectionType1 = !this.m_Orthographic.boolValue ? CameraEditor.ProjectionType.Perspective : CameraEditor.ProjectionType.Orthographic;
            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = this.m_Orthographic.hasMultipleDifferentValues;
            CameraEditor.ProjectionType projectionType2 = (CameraEditor.ProjectionType)EditorGUILayout.EnumPopup("Projection", (Enum)projectionType1, new GUILayoutOption[0]);
            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                this.m_Orthographic.boolValue = projectionType2 == CameraEditor.ProjectionType.Orthographic;
            }
            if (!this.m_Orthographic.hasMultipleDifferentValues)
            {
                if (EditorGUILayout.BeginFadeGroup(this.m_ShowOrthoOptions.faded))
                {
                    EditorGUILayout.PropertyField(this.m_OrthographicSize, new GUIContent("Size"), new GUILayoutOption[0]);
                }
                EditorGUILayout.EndFadeGroup();
                if (EditorGUILayout.BeginFadeGroup(1f - this.m_ShowOrthoOptions.faded))
                {
                    EditorGUILayout.Slider(this.m_FieldOfView, 1f, 179f, new GUIContent("Field of View"), new GUILayoutOption[0]);
                }
                EditorGUILayout.EndFadeGroup();
            }
            EditorGUILayout.PropertiesField(EditorGUI.s_ClipingPlanesLabel, this.m_NearAndFarClippingPlanes, EditorGUI.s_NearAndFarLabels, 35f);
            EditorGUILayout.PropertyField(this.m_NormalizedViewPortRect, this.m_ViewportLabel, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(this.m_Depth);
            EditorGUILayout.IntPopup(this.m_RenderingPath, CameraEditor.kCameraRenderPaths, CameraEditor.kCameraRenderPathValues, EditorGUIUtility.TempContent("Rendering Path"), new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_TargetTexture);
            EditorGUILayout.PropertyField(this.m_OcclusionCulling);
            EditorGUILayout.PropertyField(this.m_HDR);
            if (this.m_HDR.boolValue)
            {
                this.DisplayHDRWarnings();
            }
            if (PlayerSettings.stereoscopic3D)
            {
                EditorGUILayout.PropertyField(this.m_StereoSeparation);
                EditorGUILayout.PropertyField(this.m_StereoConvergence);
            }
            if (this.ShouldShowTargetDisplayProperty())
            {
                int intValue = this.m_TargetDisplay.intValue;
                EditorGUILayout.Space();
                EditorGUILayout.IntPopup(this.m_TargetDisplay, DisplayUtility.GetDisplayNames(), DisplayUtility.GetDisplayIndices(), EditorGUIUtility.TempContent("Target Display"), new GUILayoutOption[0]);
                if (intValue != this.m_TargetDisplay.intValue)
                {
                    GameView.RepaintAll();
                }
            }
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowTargetEyeOption.faded))
            {
                EditorGUILayout.IntPopup(this.m_TargetEye, CameraEditor.kTargetEyes, CameraEditor.kTargetEyeValues, EditorGUIUtility.TempContent("Target Eye"), new GUILayoutOption[0]);
            }
            EditorGUILayout.EndFadeGroup();
            this.DepthTextureModeGUI();
            this.CommandBufferGUI();
            this.serializedObject.ApplyModifiedProperties();
        }
Beispiel #6
0
        public override void OnInspectorGUI()
        {
            base.serializedObject.Update();
            Camera camera = (Camera)base.target;

            this.m_ShowBGColorOptions.target  = (!this.m_ClearFlags.hasMultipleDifferentValues && (camera.clearFlags == CameraClearFlags.Color || camera.clearFlags == CameraClearFlags.Skybox));
            this.m_ShowOrthoOptions.target    = (!this.m_Orthographic.hasMultipleDifferentValues && camera.orthographic);
            this.m_ShowTargetEyeOption.target = (this.m_TargetEye.intValue != 3 || PlayerSettings.virtualRealitySupported);
            EditorGUILayout.PropertyField(this.m_ClearFlags, new GUILayoutOption[0]);
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowBGColorOptions.faded))
            {
                EditorGUILayout.PropertyField(this.m_BackgroundColor, new GUIContent("Background", "Camera clears the screen to this color before rendering."), new GUILayoutOption[0]);
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUILayout.PropertyField(this.m_CullingMask, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            CameraEditor.ProjectionType projectionType = (!this.m_Orthographic.boolValue) ? CameraEditor.ProjectionType.Perspective : CameraEditor.ProjectionType.Orthographic;
            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = this.m_Orthographic.hasMultipleDifferentValues;
            projectionType           = (CameraEditor.ProjectionType)EditorGUILayout.EnumPopup("Projection", projectionType, new GUILayoutOption[0]);
            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                this.m_Orthographic.boolValue = (projectionType == CameraEditor.ProjectionType.Orthographic);
            }
            if (!this.m_Orthographic.hasMultipleDifferentValues)
            {
                if (EditorGUILayout.BeginFadeGroup(this.m_ShowOrthoOptions.faded))
                {
                    EditorGUILayout.PropertyField(this.m_OrthographicSize, new GUIContent("Size"), new GUILayoutOption[0]);
                }
                EditorGUILayout.EndFadeGroup();
                if (EditorGUILayout.BeginFadeGroup(1f - this.m_ShowOrthoOptions.faded))
                {
                    EditorGUILayout.Slider(this.m_FieldOfView, 1f, 179f, new GUIContent("Field of View"), new GUILayoutOption[0]);
                }
                EditorGUILayout.EndFadeGroup();
            }
            EditorGUILayout.PropertiesField(EditorGUI.s_ClipingPlanesLabel, this.m_NearAndFarClippingPlanes, EditorGUI.s_NearAndFarLabels, 35f, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_NormalizedViewPortRect, this.m_ViewportLabel, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(this.m_Depth, new GUILayoutOption[0]);
            EditorGUILayout.IntPopup(this.m_RenderingPath, CameraEditor.kCameraRenderPaths, CameraEditor.kCameraRenderPathValues, EditorGUIUtility.TempContent("Rendering Path"), new GUILayoutOption[0]);
            if (this.m_ShowOrthoOptions.target && this.wantDeferredRendering)
            {
                EditorGUILayout.HelpBox("Deferred rendering does not work with Orthographic camera, will use Forward.", MessageType.Warning, true);
            }
            EditorGUILayout.PropertyField(this.m_TargetTexture, new GUILayoutOption[0]);
            if (!this.m_TargetTexture.hasMultipleDifferentValues)
            {
                RenderTexture renderTexture = this.m_TargetTexture.objectReferenceValue as RenderTexture;
                if (renderTexture && renderTexture.antiAliasing > 1 && this.wantDeferredRendering)
                {
                    EditorGUILayout.HelpBox("Manual MSAA target set with deferred rendering. This will lead to undefined behavior.", MessageType.Warning, true);
                }
            }
            EditorGUILayout.PropertyField(this.m_OcclusionCulling, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_HDR, EditorGUIUtility.TempContent("Allow HDR"), new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_AllowMSAA, new GUILayoutOption[0]);
            this.DisplayCameraWarnings();
            if (PlayerSettings.virtualRealitySupported)
            {
                EditorGUILayout.PropertyField(this.m_StereoSeparation, new GUILayoutOption[0]);
                EditorGUILayout.PropertyField(this.m_StereoConvergence, new GUILayoutOption[0]);
            }
            if (this.ShouldShowTargetDisplayProperty())
            {
                int intValue = this.m_TargetDisplay.intValue;
                EditorGUILayout.Space();
                EditorGUILayout.IntPopup(this.m_TargetDisplay, DisplayUtility.GetDisplayNames(), DisplayUtility.GetDisplayIndices(), EditorGUIUtility.TempContent("Target Display"), new GUILayoutOption[0]);
                if (intValue != this.m_TargetDisplay.intValue)
                {
                    GameView.RepaintAll();
                }
            }
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowTargetEyeOption.faded))
            {
                EditorGUILayout.IntPopup(this.m_TargetEye, CameraEditor.kTargetEyes, CameraEditor.kTargetEyeValues, EditorGUIUtility.TempContent("Target Eye"), new GUILayoutOption[0]);
            }
            EditorGUILayout.EndFadeGroup();
            this.DepthTextureModeGUI();
            this.CommandBufferGUI();
            base.serializedObject.ApplyModifiedProperties();
        }
Beispiel #7
0
 public override void OnInspectorGUI()
 {
     this.serializedObject.Update();
     if (this.m_AllRoot)
     {
         EditorGUILayout.PropertyField(this.m_RenderMode);
         this.m_OverlayMode.target = this.m_RenderMode.intValue == 0;
         this.m_CameraMode.target  = this.m_RenderMode.intValue == 1;
         this.m_WorldMode.target   = this.m_RenderMode.intValue == 2;
         ++EditorGUI.indentLevel;
         if (EditorGUILayout.BeginFadeGroup(this.m_OverlayMode.faded))
         {
             EditorGUILayout.PropertyField(this.m_PixelPerfect);
             EditorGUILayout.PropertyField(this.m_SortingOrder, this.sortingOrder, new GUILayoutOption[0]);
             EditorGUILayout.IntPopup(this.m_TargetDisplay, DisplayUtility.GetDisplayNames(), DisplayUtility.GetDisplayIndices(), this.targetDisplay, new GUILayoutOption[0]);
         }
         EditorGUILayout.EndFadeGroup();
         if (EditorGUILayout.BeginFadeGroup(this.m_CameraMode.faded))
         {
             EditorGUILayout.PropertyField(this.m_PixelPerfect);
             EditorGUILayout.PropertyField(this.m_Camera, this.renderCamera, new GUILayoutOption[0]);
             if (this.m_Camera.objectReferenceValue != (UnityEngine.Object)null)
             {
                 EditorGUILayout.PropertyField(this.m_PlaneDistance);
             }
             EditorGUILayout.Space();
             if (this.m_Camera.objectReferenceValue != (UnityEngine.Object)null)
             {
                 EditorGUILayout.SortingLayerField(this.m_SortingLayerStyle, this.m_SortingLayerID, EditorStyles.popup, EditorStyles.label);
             }
             EditorGUILayout.PropertyField(this.m_SortingOrder, this.m_SortingOrderStyle, new GUILayoutOption[0]);
             if (this.m_Camera.objectReferenceValue == (UnityEngine.Object)null)
             {
                 EditorGUILayout.HelpBox("Screen Space - Camera with no specified camera acts like a Overlay Canvas", MessageType.Warning);
             }
         }
         EditorGUILayout.EndFadeGroup();
         if (EditorGUILayout.BeginFadeGroup(this.m_WorldMode.faded))
         {
             EditorGUILayout.PropertyField(this.m_Camera, this.eventCamera, new GUILayoutOption[0]);
             EditorGUILayout.Space();
             EditorGUILayout.SortingLayerField(this.m_SortingLayerStyle, this.m_SortingLayerID, EditorStyles.popup);
             EditorGUILayout.PropertyField(this.m_SortingOrder, this.m_SortingOrderStyle, new GUILayoutOption[0]);
         }
         EditorGUILayout.EndFadeGroup();
         --EditorGUI.indentLevel;
     }
     else if (this.m_AllNested)
     {
         EditorGUI.BeginChangeCheck();
         this.pixelPerfect = (CanvasEditor.PixelPerfect)EditorGUILayout.EnumPopup("Pixel Perfect", (Enum)this.pixelPerfect, new GUILayoutOption[0]);
         if (EditorGUI.EndChangeCheck())
         {
             if (this.pixelPerfect == CanvasEditor.PixelPerfect.Inherit)
             {
                 this.m_PixelPerfectOverride.boolValue = false;
             }
             else if (this.pixelPerfect == CanvasEditor.PixelPerfect.Off)
             {
                 this.m_PixelPerfectOverride.boolValue = true;
                 this.m_PixelPerfect.boolValue         = false;
             }
             else
             {
                 this.m_PixelPerfectOverride.boolValue = true;
                 this.m_PixelPerfect.boolValue         = true;
             }
         }
         EditorGUILayout.PropertyField(this.m_OverrideSorting);
         this.m_SortingOverride.target = this.m_OverrideSorting.boolValue;
         if (EditorGUILayout.BeginFadeGroup(this.m_SortingOverride.faded))
         {
             if (this.m_AllOverlay)
             {
                 EditorGUILayout.PropertyField(this.m_SortingOrder, this.sortingOrder, new GUILayoutOption[0]);
             }
             else if (this.m_NoneOverlay)
             {
                 EditorGUILayout.SortingLayerField(this.m_SortingLayerStyle, this.m_SortingLayerID, EditorStyles.popup);
                 EditorGUILayout.PropertyField(this.m_SortingOrder, this.m_SortingOrderStyle, new GUILayoutOption[0]);
             }
         }
         EditorGUILayout.EndFadeGroup();
     }
     else
     {
         GUILayout.Label(CanvasEditor.s_RootAndNestedMessage, EditorStyles.helpBox, new GUILayoutOption[0]);
     }
     this.serializedObject.ApplyModifiedProperties();
 }
Beispiel #8
0
 public void DrawMultiDisplay()
 {
     if (ModuleManager.ShouldShowMultiDisplayOption())
     {
         int intValue = this.targetDisplay.intValue;
         EditorGUILayout.Space();
         EditorGUILayout.IntPopup(this.targetDisplay, DisplayUtility.GetDisplayNames(), DisplayUtility.GetDisplayIndices(), EditorGUIUtility.TempContent("Target Display"), new GUILayoutOption[0]);
         if (intValue != this.targetDisplay.intValue)
         {
             GameView.RepaintAll();
         }
     }
 }
        private void AllRootCanvases()
        {
            if (VREditor.GetVREnabledOnTargetGroup(BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget)) && (m_RenderMode.enumValueIndex == (int)RenderMode.ScreenSpaceOverlay))
            {
                EditorGUILayout.HelpBox("Using a render mode of ScreenSpaceOverlay while VR is enabled will cause the Canvas to continue to incur a rendering cost, even though the Canvas will not be visible in VR.", MessageType.Warning);
            }

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(m_RenderMode);
            if (EditorGUI.EndChangeCheck())
            {
                var rectTransforms = targets.Select(c => (c as Canvas).transform).ToArray();
                Undo.RegisterCompleteObjectUndo(rectTransforms, "Modified RectTransform Values");
                serializedObject.ApplyModifiedProperties();
                foreach (Canvas canvas in targets)
                {
                    canvas.UpdateCanvasRectTransform(true);
                }
                GUIUtility.ExitGUI();
            }

            m_OverlayMode.target = m_RenderMode.intValue == 0;
            m_CameraMode.target  = m_RenderMode.intValue == 1;
            m_WorldMode.target   = m_RenderMode.intValue == 2;

            EditorGUI.indentLevel++;
            if (EditorGUILayout.BeginFadeGroup(m_OverlayMode.faded))
            {
                DoPixelPerfectGUIForRoot();

                EditorGUILayout.PropertyField(m_SortingOrder, Styles.sortingOrder);
                GUIContent[] displayNames = DisplayUtility.GetDisplayNames();
                EditorGUILayout.IntPopup(m_TargetDisplay, displayNames, DisplayUtility.GetDisplayIndices(), Styles.targetDisplay);
            }
            EditorGUILayout.EndFadeGroup();

            if (EditorGUILayout.BeginFadeGroup(m_CameraMode.faded))
            {
                DoPixelPerfectGUIForRoot();

                EditorGUILayout.PropertyField(m_Camera, Styles.renderCamera);

                if (m_Camera.objectReferenceValue == null)
                {
                    EditorGUILayout.HelpBox("A Screen Space Canvas with no specified camera acts like an Overlay Canvas.",
                                            MessageType.Warning);
                }

                if (m_Camera.objectReferenceValue != null)
                {
                    EditorGUILayout.PropertyField(m_PlaneDistance);
                    EditorGUILayout.PropertyField(m_UpdateRectTransformForStandalone, Styles.standaloneRenderResize);
                }

                EditorGUILayout.Space();

                if (m_Camera.objectReferenceValue != null)
                {
                    EditorGUILayout.SortingLayerField(Styles.m_SortingLayerStyle, m_SortingLayerID, EditorStyles.popup, EditorStyles.label);
                }
                EditorGUILayout.PropertyField(m_SortingOrder, Styles.m_SortingOrderStyle);
            }
            EditorGUILayout.EndFadeGroup();

            if (EditorGUILayout.BeginFadeGroup(m_WorldMode.faded))
            {
                EditorGUILayout.PropertyField(m_Camera, Styles.eventCamera);

                if (m_Camera.objectReferenceValue == null)
                {
                    EditorGUILayout.HelpBox("A World Space Canvas with no specified Event Camera may not register UI events correctly.",
                                            MessageType.Warning);
                }

                EditorGUILayout.Space();
                EditorGUILayout.SortingLayerField(Styles.m_SortingLayerStyle, m_SortingLayerID, EditorStyles.popup);
                EditorGUILayout.PropertyField(m_SortingOrder, Styles.m_SortingOrderStyle);
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUI.indentLevel--;
        }