public class L13 : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
//滑动块相关参数
//Size滑动块在条中的比例大小
//监听事件的两种方法
//1.拖脚本
//2.代码添加(float)
Scrollbar sb = GetComponent<Scrollbar>();
sb.onValueChanged.AddListener((a) => { });
//ScrollView相关参数
//Content 想要在ScrollView中显示的东西的父对象
//Movement Type
//Elastic 回弹模式 - Elasticity 回弹系数,值越大回弹越慢
//Clamp 夹紧模式,始终在可视范围内,没有回弹效果
//Inertia 移动惯性
//Deceleration Rate 减速率,0为没有惯性,1不会停下
//Scroll Sensitivity 鼠标中键滚动灵敏度
//ScrollBar Spacing 滚动条和Viewport的间距
//代码控制
ScrollRect scrollRect = GetComponent<ScrollRect>();
//改变内容大小
scrollRect.content.sizeDelta = new Vector2(100,100);
scrollRect.normalizedPosition = new Vector2(0,0.5f);
//监听事件的两种方式
//1.拖脚本
//2.代码添加(Vector2)
scrollRect.onValueChanged.AddListener((a) => { });
}
}