Firstborn/Assets/Scripts/ToggleOffOn.cs

27 lines
454 B
C#
Raw Normal View History

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;
}
}
}