Heroes_of_Hiis/Assets/Project Files/Scripts/Arlo/Menu.cs

34 lines
645 B
C#
Raw Normal View History

2022-03-19 20:29:19 +00:00
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()
{
}
}