Version: 2017.2

GUILayout.EndScrollView

切换到手册
public static void EndScrollView ();

描述

结束通过 BeginScrollView 调用开始的滚动视图。

另请参阅:GUILayout.BeginScrollView

\ 游戏视图中的滚动视图。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Vector2 scrollPosition; public string longString = "This is a long-ish string"; void OnGUI() { scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(100), GUILayout.Height(100)); GUILayout.Label(longString); if (GUILayout.Button("Clear")) longString = ""; GUILayout.EndScrollView(); if (GUILayout.Button("Add More Text")) longString += "\nHere is another line"; } }