-
04/26 유니티 NGUI 버튼, 입력창 연습유니티 2021. 4. 26. 16:54
Button
NGUI는 버튼구현 시 Collider 컴포넌트가 있어야 함
InputField
라벨을 스프라이트에 자식에 두고, 스프라이트에 InputField와 Collider 컴포넌트를 추가
자식에 위치한 라벨을 InputField의 Lavel속성에 어사인
using System.Collections; using System.Collections.Generic; using UnityEngine; public class UISignup : MonoBehaviour { public UIButton btnClose; public UILabel labelEmail; public UILabel labelUserName; public UILabel labelPassword; public UIButton btnSignUp; public UIButton btnSignIn; // Start is called before the first frame update void Start() { btnClose.onClick.Add(new EventDelegate(() => { Debug.Log("btnClose"); })); btnSignUp.onClick.Add(new EventDelegate(() => { Debug.Log("btnSignUp" + " " + labelEmail.text + " " + labelUserName.text + " " + labelPassword.text); })); btnSignIn.onClick.Add(new EventDelegate(() => { Debug.Log("btnSignIn"); })); } // Update is called once per frame void Update() { } }
'유니티' 카테고리의 다른 글
04/26 유니티 입력값 출력 복습 NGUI, UGUI (0) 2021.04.27 04/26 유니티 NGUI slider 사용 연습 (0) 2021.04.26 04/23 유니티 스크롤 뷰 + 데이터 연동 연습 (0) 2021.04.23 04/23 유니티 UI 스크롤 뷰 만들기 (0) 2021.04.23 04/22 유니티 UIAnimation (0) 2021.04.22