Unity 为Button添加监听方法

2022-03-26  本文已影响0人  114105lijia
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()
    {
        
    }
}







上一篇下一篇

猜你喜欢

热点阅读