using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class TestComponent1Main : MonoBehaviour
{
public GameObject[] arrButtonGo;
void Start()
{
//버튼을 클릭하면 파랑색 버튼누르면 0 , 노랑색 버튼 누르면 1 출력
for (int i = 0; i < arrButtonGo.Length; i++)
{
int index = i;
GameObject go = arrButtonGo[index];
Button btn = go.GetComponent<Button>();
btn.onClick.AddListener(() => {
Debug.Log(index);
});
}
}
}'게임 UI,UX 프로그래밍' 카테고리의 다른 글
| 체크 박스 (0) | 2024.08.30 |
|---|---|
| 쿨타임 표기 (0) | 2024.08.29 |
| 인풋필드 만들기 (0) | 2024.08.29 |
| 슬라이더 버튼 만들기 (0) | 2024.08.29 |
| toggle 스위치 버튼 만들기 (0) | 2024.08.29 |