ぽちぽち押すと、文字が切り替わっていくボタン実装
ソートボタンとかの、強い順→弱い順→新しい順→… みたいなやつです
using System.Collections.Generic;
public class ToggleText : MonoBehaviour {
public List<string> StateTexts = new List<string>();
public int State = 0;
public UILabel LabelObj =null;
void Start () {
SetText(State);
}
public void Increment(){
SetText(State + 1);
}
public void SetText(int _idx){
if( _idx >= StateTexts.Count ){
_idx = 0;
}
if( LabelObj != null ){
LabelObj.text = StateTexts[_idx];
}
State = _idx;
}
}