private void OnSceneGUI() { Event e = Event.current; //Step Object if (e.type == EventType.ScrollWheel && e.shift) { (target as Collection)?.Step(CollectionUtility.GetScrollStep(e)); e.Use(); } //Rotate Object if (e.type == EventType.ScrollWheel && e.alt) { (target as Collection)?.StepRotation(CollectionUtility.GetScrollStep(e)); e.Use(); } //Randomize Object if (e.isMouse && e.button == 2 && e.shift) { (target as Collection)?.Randomize(); e.Use(); } Handles.BeginGUI(); //Add padding EditorGUILayout.LabelField(""); EditorGUILayout.LabelField("Scroll + Shift: Step through objects"); EditorGUILayout.LabelField("Scroll + Alt: Rotate Object"); EditorGUILayout.LabelField("Middle Mouse + Shift: Random objects"); Handles.EndGUI(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); if (Application.isPlaying) { return; } CollectionGroup myTarget = (CollectionGroup)target; DrawChildren(myTarget); EditorGUILayout.Space(); //Children EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("All Children"); if (GUILayout.Button("<-", GUILayout.ExpandWidth(false))) { myTarget.Step(-1); } if (GUILayout.Button("->", GUILayout.ExpandWidth(false))) { myTarget.Step(1); } if (GUILayout.Button("?", GUILayout.ExpandWidth(false))) { myTarget.Randomize(); } EditorGUILayout.EndHorizontal(); //Scrolling if (Event.current.type == EventType.ScrollWheel) { myTarget.Step(CollectionUtility.GetScrollStep(Event.current)); } }