UI.Button 按下抬起

实际需求可能不止 单击一下,可能还有抬起,按下 移动等事件

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using UnityEngine.Events;

public class platformInput : UIBehaviour,IPointerDownHandler,IPointerUpHandler
{
    public void OnPointerUp(PointerEventData ev) 
    {
        Debug.Log("up");
        PlayerController.ins._is_brake = false; 
    }
   public  void OnPointerDown(PointerEventData ev)
    {
        Debug.Log("down");

        AudioMgr.ins.playBrake();
        PlayerController.ins._is_brake = true;

    }
    public bool Stop()
    {
#if UNITY_STANDALONE_WIN
        return Input.GetKey(KeyCode.D);
#endif
        return false;
    }

}


你可能感兴趣的:(UI.Button 按下抬起)