Stratasys-450mc-VR/Assets/Scripts/UIToggler.cs

26 lines
581 B
C#
Raw Normal View History

2023-11-01 10:51:29 -04:00
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);
}
}