Class ToggleActive
A simple utility MonoBehaviour that toggles the active state of its own GameObject.
public class ToggleActive : MonoBehaviour
Inheritance
Methods
TooggleActive()
Toggles the active state of this GameObject. If the object is currently active, it will be deactivated, and vice versa.
public void TooggleActive()
Examples
The example demonstrates how to use the ToggleActive component:
using UnityEngine;
using UnityEngine.UI;
public class ToggleExample : MonoBehaviour
{
[SerializeField] private Button toggleButton;
[SerializeField] private ToggleActive target;
private void Start()
{
toggleButton.onClick.AddListener(target.TooggleActive);
}
}