using System; using System.Collections.Generic; using UnityEngine; public class CheatsHotkeys : MonoBehaviour { private readonly List _windows = new List(10); private void Awake() { #if !UNITY_EDITOR Destroy(this); #endif } private void Update() { ToggleUI(); } private void ToggleUI() { if (Input.GetKeyDown(KeyCode.Space)) { bool hasClosedWindows = _windows.Count > 0; if (UI.GetVisibleStack().Count > 0) _windows.Clear(); if (hasClosedWindows) { foreach (var window in _windows) window.Show(); _windows.Clear(); } else { _windows.AddRange(UI.GetVisibleStack()); foreach (Window window in _windows) window.Hide(); } } } }