728x90
using UnityEngine.EventSystems;
public class ButtonController : MonoBehaviour
{
public void GetButtonName(){
// 버튼 이름 가져오기
string ButtonName = EventSystem.current.currentSelectedGameObject.name;
Debug.Log(ButtonName);
}
}
기능이 같지만 버튼 이름이 다를 경우처럼 클릭한 오브젝트(버튼)의 이름을 가져오기 위한 방법입니다!
728x90
반응형
'소프트웨어 개발 > 유니티(Unity)' 카테고리의 다른 글
[Unity] 코루틴(Corutine) NullReferenceException 해결방법 (0) | 2022.04.13 |
---|---|
[Unity] 구글 플레이에 게임 출시 / 빌드 설정 방법 (0) | 2022.03.11 |
[Unity] '' is an incorrect path for a scene file. BuildPlayer expects paths relative to the project folder. 오류 해결방법! (0) | 2021.11.09 |
[Unity] 리스트 관련 함수 (0) | 2021.10.14 |
[Unity] 문자열 역순으로 출력 (0) | 2021.08.17 |
댓글