代码如下
using UnityEngine.UI;
using UnityEngine.EventSystems;
using UnityEngine;
/// <summary>
/// 解决嵌套使用ScrollRect时的Drag冲突问题。请将该脚本放置到内层ScrollRect上(外层的ScrollRect的Drag事件会被内层的拦截)
/// </summary>
public class NestedScrollRect : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
{
/// <summary>
/// 外层被拦截需要正常拖动的ScrollRect,可不指定,默认在父对象中找
/// </summary>
public ScrollRect anotherScrollRect;
/// <summary>
/// 当前的ScrollRect(本脚本所放置的物体上)的拖动方向默认为上下拖动,否则为左右拖动型
/// </summary>
public bool thisIsUpAndDown = true;
private ScrollRect thisScrollRect;
void Awake ()
<