using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; public class ChatLinkListener : MonoBehaviour, IPointerClickHandler, IBeginDragHandler, IDragHandler, IEndDragHandler { public ScrollRect Scroll; private void Start() { } public void OnPointerClick(PointerEventData eventData) { } public void OnDrag(PointerEventData eventData) { Scroll.OnDrag(eventData); } public void OnBeginDrag(PointerEventData eventData) { Scroll.OnBeginDrag(eventData); } public void OnEndDrag(PointerEventData eventData) { Scroll.OnEndDrag(eventData); } }
只要将此脚本挂载到需要拖拽并且挂着EventTrigger的对象上即可