Button Group Attribute 特性:用于可用于任何實例函數征唬,并將按鈕添加到組織為水平組的檢查器中。使用此按鈕可以將多個按鈕組織在一個整齊的水平組中茁彭。
using Sirenix.OdinInspector;
using UnityEngine;
public class ButtonGroupAttributeExample : MonoBehaviour
{
[ButtonGroup]
private void A()
{
}
[ButtonGroup]
private void B()
{
}
[ButtonGroup]
private void C()
{
}
[ButtonGroup]
private void D()
{
}
[Button(ButtonSizes.Large)]
[ButtonGroup("My Button Group")]
private void E()
{
}
[GUIColor(0, 1, 0)]
[ButtonGroup("My Button Group")]
private void F()
{
}
[BoxGroup("Titles", ShowLabel = false)]
public int A1;
[BoxGroup("Titles/Boxed")]
public int B1;
public int C1;
[ButtonGroup("Titles/Buttons")]
public void FirstButton() { }
[ButtonGroup("Titles/Buttons")]
public void SecondButton() { }
}