유니티
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()
{
}
}