20 lines
434 B
C#
20 lines
434 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
[RequireComponent(typeof(Toggle))]
|
|
public class UI_Toggle : MonoBehaviour
|
|
{
|
|
Toggle toggle;
|
|
void Awake()
|
|
{
|
|
TryGetComponent(out toggle);
|
|
Active(toggle.isOn);
|
|
toggle.onValueChanged.AddListener(Active);
|
|
}
|
|
void Active(bool isOn)
|
|
{
|
|
toggle.graphic.gameObject.SetActive(isOn);
|
|
}
|
|
}
|