using System; using System.Collections.Generic; using UnityEngine; namespace Leap.Unity { public class KeyEnableGameObjects : MonoBehaviour { private void Update() { if (this.unlockHold != KeyCode.None && !Input.GetKey(this.unlockHold)) { return; } if (Input.GetKeyDown(this.toggle)) { foreach (GameObject gameObject in this.targets) { gameObject.SetActive(!gameObject.activeSelf); } } } public List targets; [Header("Controls")] public KeyCode unlockHold = KeyCode.RightShift; public KeyCode toggle = KeyCode.T; } }