2
我有一個用戶界面圖像,我希望它在用戶界面按鈕單擊時顯示不同的圖像。我知道如何循環UI文本,但不是UI圖像。以下是我可以用文字做的事情:通過圖像陣列循環
Text text;
string[] array = {"Hi!", "Ho!", "You clicked me!"};
int num = 0;
void Start() {
text = GetComponent<Text>();
}
void Change() {
num++;
if(num == 3) {
num = 0;
}
text.text = array[num];
}
我該如何對圖像做同樣的事情?
請找到一個更好的標題您的問題! – 2015-03-08 18:06:03
@AndreasNiedermair那怎麼樣? – 2015-03-08 18:07:20
好得多!但是:請參閱[「應該在其標題中包含」標籤「?](http://meta.stackexchange.com/questions/19190/should-questions-include-tags-in-their-titles),其中共識是「不,他們不應該」! – 2015-03-08 18:08:51