在菜单栏中打开
-
NGUI->Open->Widget Wizard
使用工具生成Button
或者在
Project
中搜索Control
几个设置需要注意的地方:
挂载脚本处理逻辑:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UIMainController : MonoBehaviour
{
// Start is called before the first frame update
[SerializeField]
public UIButton loginButton;
[SerializeField]
public UIButton logoutButton;
private void Awake()
{
UIEventListener.Get(loginButton.gameObject).onClick = OnClick;
UIEventListener.Get(logoutButton.gameObject).onClick = OnClick;
}
void Start()
{
}
public void OnClick(GameObject gameObject)
{
}
// Update is called once per frame
void Update()
{
}
}
Button动画
在button上挂载Button Rotation
等脚本
设置Duration和旋转方向