在菜单栏中打开
-
NGUI->Open->Widget Wizard使用工具生成Button

截屏2023-08-24 13.10.32.png
或者在
Project中搜索Control
截屏2023-08-24 13.16.21.png
几个设置需要注意的地方:

WeChate261a47172663d594a6d6815230cf83d.jpg

WeChat8db3cf8b034f44f79a0fd8e2f655f3e3.jpg
挂载脚本处理逻辑:

WeChat1bf8c712561122c27b1eab5cf24b226c.jpg
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和旋转方向