美文网首页
Unity NGUI.Button使用

Unity NGUI.Button使用

作者: ___________枫林晚 | 来源:发表于2023-08-23 13:43 被阅读0次

    在菜单栏中打开

    • 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和旋转方向

    相关文章

      网友评论

          本文标题:Unity NGUI.Button使用

          本文链接:https://www.haomeiwen.com/subject/smypmdtx.html