using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
public class UIManager : MonoBehaviour
{
[SerializeField]
private Button btnStart;
[SerializeField]
private Button btnOption;
[SerializeField]
private Button btnShop;
private UnityAction action;
private void Start()
{
this.action = () => this.OnButtonClick(this.btnStart.name);
this.btnStart.onClick.AddListener(this.action);
//this.btnStart.onClick.AddListener(() => {
// this.OnButtonClick(this.btnStart.name);
//});
this.btnOption.onClick.AddListener(() => {
this.OnButtonClick(this.btnOption.name);
});
this.btnShop.onClick.AddListener(() => {
this.OnButtonClick(this.btnShop.name);
});
}
public void OnButtonClick(string msg)
{
Debug.Log($"Click Button : {msg}");
}
}
'유니티 심화' 카테고리의 다른 글
[주말과제/미완] HeroShooter - 총알나가고 삭제 (0) | 2023.08.28 |
---|---|
HeroShooter - 몬스터를 발견하면 공격애니메이션 실행 (0) | 2023.08.25 |
절대강좌 유니티 - UI (0) | 2023.08.25 |
HeroShooter - 가까운 거리 몬스터 선 그리기 (0) | 2023.08.24 |
절대강좌 유니티 - 혈흔효과, 몬스터 공격효과, 델리게이트, 죽으면 강남스타일, 본 구조, 충돌감지, 몬스터 사망 (0) | 2023.08.24 |