using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.InputSystem; public class Menu : MonoBehaviour { public InputActionReference toggleReference; // Start is called before the first frame update void Awake() { toggleReference.action.started += Toggle; } private void OnDestroy() { toggleReference.action.started -= Toggle; } void Toggle(InputAction.CallbackContext context) { bool isActive = gameObject.active; gameObject.SetActive(!isActive); } // Update is called once per frame void Update() { } }