美文网首页
Unity 为Button添加监听方法

Unity 为Button添加监听方法

作者: 114105lijia | 来源:发表于2022-03-26 09:03 被阅读0次
using UnityEngine.UI;

public class Animation : MonoBehaviour
{

    public Button startBtn;

    // Start is called before the first frame update
    void Start()
    {
        startBtn.onClick.AddListener(startAction);
    }

    void startAction()
    {
    
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}







相关文章

网友评论

      本文标题:Unity 为Button添加监听方法

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