36 lines
869 B
C#
Raw Normal View History

2023-11-03 08:51:51 -04:00
using UnityEngine;
namespace UnityEngine.XR.Interaction.Toolkit.Samples
{
public class ToggleGameObject : MonoBehaviour
{
[SerializeField]
GameObject m_ActivationGameObject;
public GameObject activationGameObject
{
get => m_ActivationGameObject;
set => m_ActivationGameObject = value;
}
[SerializeField]
bool m_CurrentlyActive = false;
public bool currentlyActive
{
get => m_CurrentlyActive;
set
{
m_CurrentlyActive = value;
activationGameObject.SetActive(m_CurrentlyActive);
}
}
public void ToggleActiveState()
{
m_CurrentlyActive = !m_CurrentlyActive;
activationGameObject.SetActive(m_CurrentlyActive);
}
}
}