GameObject.Find("Scroll View").GetComponent<ScrollRect>().OnBeginDrag(data);
GameObject.Find("Scroll View").GetComponent<ScrollRect>().OnDrag(data);
GameObject.Find("Scroll View").GetComponent<ScrollRect>().OnEndDrag(data);
//将单个物体的拖拽事件,传递给滑动区域
本文介绍如何在Unity中使用GameObject.Find方法找到名为ScrollView的物体,并通过GetComponent方法获取其ScrollRect组件,实现对ScrollView的OnBeginDrag, OnDrag 和 OnEndDrag事件的监听与操作。
GameObject.Find("Scroll View").GetComponent<ScrollRect>().OnBeginDrag(data);
GameObject.Find("Scroll View").GetComponent<ScrollRect>().OnDrag(data);
GameObject.Find("Scroll View").GetComponent<ScrollRect>().OnEndDrag(data);
//将单个物体的拖拽事件,传递给滑动区域
5487
2万+
1184

被折叠的 条评论
为什么被折叠?