You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
710 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class OneButtonOn : MonoBehaviour
{
public Toggle[] one;//µÚÒ»µÀÌâ
private void Start()
{
for (int i = 0; i < one.Length; i++)
{
int k = i;
one[i].onValueChanged.AddListener((bool bo) => oneToggleCtrl(bo, k));
}
}
public void oneToggleCtrl(bool bo, int id)
{
if (bo)
{
for (int i = 0; i < id; i++)
{
one[i].isOn = false;
}
for (int i = id + 1; i < one.Length; i++)
{
one[i].isOn = false;
}
}
}
}