Unity3D中的ToggleGroup,它是活动的?

时间:2016-04-22 15:24:43

标签: user-interface unity3d toggle dropdown

我们如何知道切换组中哪个切换有效?

Unity Doc说使用ToggleGroup.ActiveToggles但我无法理解如何使用它?

1 个答案:

答案 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);
  }