Insert a group managed by hSliderValue1 inside the new group.
using System; using System.Collections.Generic; using UnityEngine; using UnityEditor; public class ZoomMoveTestWindow: EditorWindow { private static float kEditorWindowTabHeight = 20; private static Matrix4x4 _prevGuiMatrix; public static float hSliderValue1 = 0; public static float hSliderValue2 = 0; Rect[] wr = new Rect[]{ new Rect(0, 0, 100, 100), new Rect(50, 50, 100, 100), new Rect(100, 100, 100, 100) }; [MenuItem("Window/Zoom Test #%w")] private static void Init() { ZoomMoveTestWindow window = EditorWindow.GetWindow<ZoomMoveTestWindow>("Zoom Test", true, new System.Type[] { typeof(UnityEditor.SceneView), typeof(EditorWindow).Assembly.GetType("UnityEditor.SceneHierarchyWindow")}); window.Show(); EditorWindow.FocusWindowIfItsOpen<ZoomMoveTestWindow>(); } public static Rect BeginZoomArea(Rect rect) { GUI.BeginGroup(rect); GUI.BeginGroup(new Rect(hSliderValue1, 0, 200, 200)); _prevGuiMatrix = GUI.matrix; GUI.matrix = Matrix4x4.TRS(new Vector2(hSliderValue2, 0), Quaternion.identity, Vector3.one); return new Rect(); } public static void EndZoomArea() { GUI.EndGroup(); GUI.matrix = _prevGuiMatrix; GUI.EndGroup(); GUI.BeginGroup(new Rect(0.0f, kEditorWindowTabHeight, Screen.width, Screen.height - (kEditorWindowTabHeight + 3))); } public void OnGUI() { GUI.EndGroup();

It works, but I donβt know why. Since the interaction of GUI.matrix and BeginGroup(rect) unknown.
PS: This post can help you.
source share