Repository: FlaxEngine/FlaxEngine
File: Source/Editor/Viewport/PrefabWindowViewport.cs (C#)

Code before:
            Task.CollectDrawCalls += OnCollectDrawCalls;
            Task.PostRender += OnPostRender;

            // Create post effects
            SelectionOutline = FlaxEngine.Object.New<SelectionOutline>();
            SelectionOutline.SelectionGetter = () => TransformGizmo.SelectedParents;
            Task.AddCustomPostFx(SelectionOutline);
            _spritesRenderer = FlaxEngine.Object.New<PrefabSpritesRenderer>();
            _spritesRenderer.Task = Task;
            _spritesRenderer.Viewport = this;
            Task.AddCustomPostFx(_spritesRenderer);

            // Add transformation gizmo
            TransformGizmo = new TransformGizmo(this);
            TransformGizmo.ApplyTransformation += ApplyTransform;
            TransformGizmo.Duplicate += _window.Duplicate;
            Gizmos.Active = TransformGizmo;

            // Use custom root for UI controls
            _uiRoot = new PrefabUIEditorRoot(this);
            _uiRoot.IndexInParent = 0; // Move viewport down below other widgets in the viewport
            _uiParentLink = _uiRoot.UIRoot;
            
            var container = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperLeft);
            container.Parent = this;
            _uiModeButton = new ViewportWidgetButton("UI Mode", SpriteHandle.Invalid, null, true);
            _uiModeButton.Clicked += button => ShowUI = button.Checked;
            _uiModeButton.Parent = container;

            EditorGizmoViewport.AddGizmoViewportWidgets(this, TransformGizmo);

            // Setup input actions
            InputActions.Add(options => options.FocusSelection, ShowSelectedActors);

            SetUpdate(ref _update, OnUpdate);
        }

        private void OnUpdate(float deltaTime)
        {
            for (int i = 0; i < Gizmos.Count; i++)
            {
                Gizmos[i].Update(deltaTime);
            }
        }

        private void OnBegin(RenderTask task, GPUContext context)
        {
            _debugDrawData.Clear();

            // Collect selected objects debug shapes and visuals
            var selectedParents = TransformGizmo.SelectedParents;

Review comment (suggestion):
I think we should use exiting `View` button and add a checkbox for `UI Mode` (via `ViewWidgetShowMenu`).

Code after:
            Task.Begin += OnBegin;
            Task.CollectDrawCalls += OnCollectDrawCalls;
            Task.PostRender += OnPostRender;

            // Create post effects
            SelectionOutline = FlaxEngine.Object.New<SelectionOutline>();
            SelectionOutline.SelectionGetter = () => TransformGizmo.SelectedParents;
            Task.AddCustomPostFx(SelectionOutline);
            _spritesRenderer = FlaxEngine.Object.New<PrefabSpritesRenderer>();
            _spritesRenderer.Task = Task;
            _spritesRenderer.Viewport = this;
            Task.AddCustomPostFx(_spritesRenderer);

            // Add transformation gizmo
            TransformGizmo = new TransformGizmo(this);
            TransformGizmo.ApplyTransformation += ApplyTransform;
            TransformGizmo.Duplicate += _window.Duplicate;
            Gizmos.Active = TransformGizmo;

            // Use custom root for UI controls
            _uiRoot = new PrefabUIEditorRoot(this);
            _uiRoot.IndexInParent = 0; // Move viewport down below other widgets in the viewport
            _uiParentLink = _uiRoot.UIRoot;

            // UI mode buton
            _uiModeButton = ViewWidgetShowMenu.AddButton("UI Mode", (button) => ShowUI = button.Checked);
            _uiModeButton.AutoCheck = true;
            _uiModeButton.VisibleChanged += control => (control as ContextMenuButton).Checked = ShowUI;

            EditorGizmoViewport.AddGizmoViewportWidgets(this, TransformGizmo);

            // Setup input actions
            InputActions.Add(options => options.FocusSelection, ShowSelectedActors);

            SetUpdate(ref _update, OnUpdate);
        }

        private void OnUpdate(float deltaTime)
        {
            for (int i = 0; i < Gizmos.Count; i++)
            {
                Gizmos[i].Update(deltaTime);
            }
        }

        private void OnBegin(RenderTask task, GPUContext context)
        {
            _debugDrawData.Clear();

            // Collect selected objects debug shapes and visuals
            var selectedParents = TransformGizmo.SelectedParents;