using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class ToggleOffOn : MonoBehaviour { public Toggle MyToggle; public GameObject MyOBJ; public void Vanish() { if (MyToggle.isOn == false) { MyOBJ.SetActive(false); } else { MyOBJ.SetActive(true); } } public void ToggleMe() { if (MyToggle.isOn == false) { MyToggle.isOn = true; } else { MyToggle.isOn = false; } } }