Stratasys-450mc-VR/Assets/Scripts/UIToggler.cs
2023-11-07 15:13:12 -05:00

26 lines
581 B
C#

using System.Collections;
using System.Collections.Generic;
using SO.Channels;
using UnityEngine;
public class UIToggler : MonoBehaviour
{
[SerializeField] private SimpleChannelSO showAndHideUIChannel;
[SerializeField] private GameObject uiElement;
private void OnEnable()
{
showAndHideUIChannel.OnEventRaised += OnShowAndHideUI;
}
private void OnDisable()
{
showAndHideUIChannel.OnEventRaised -= OnShowAndHideUI;
}
private void OnShowAndHideUI()
{
uiElement.SetActive(!uiElement.activeSelf);
}
}