ScrollRect.normalizedPosition

切换到手册
public Vector2 normalizedPosition ;

描述

滚动位置,表示为 (0,0) 与 (1,1) 之间的 Vector2,(0,0) 表示位于左下角。

using UnityEngine;
using System.Collections;
using UnityEngine.UI;  // Required when Using UI elements.

public class ExampleClass : MonoBehaviour { public ScrollRect myScrollRect; public Vector2 myPosition = new Vector2(0.5f, 0.5f);

public void Start() { //Change the current scroll position. myScrollRect.normalizedPosition = myPosition; } }