我们如何知道切换组中哪个切换有效?
Unity Doc说使用ToggleGroup.ActiveToggles
但我无法理解如何使用它?
答案 0 :(得分:3)
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Linq;
private void Example()
{
Toggle theActiveToggle = yourToggleGroup.ActiveToggles().FirstOrDefault();
Debug.Log("It worked! " + theActiveToggle.gameObject.name);
}