Version: 2021.1
public static void EndScrollView ();

描述

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


滚动视图内的标签。

using UnityEngine;
using UnityEditor;

// Simple Editor Window that creates a scroll view with a Label inside

public class CreateEndScrollViewCS : EditorWindow { Vector2 scrollPos; string t = "This is a string inside a Scroll view!";

[MenuItem("Examples/Write text on ScrollView")] static void Init() { EditorWindow window = GetWindow(typeof(CreateEndScrollViewCS)); window.Show(); }

void OnGUI() { EditorGUILayout.BeginHorizontal(); scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(100), GUILayout.Height(100)); GUILayout.Label(t); EditorGUILayout.EndScrollView(); if (GUILayout.Button("Add More Text", GUILayout.Width(100), GUILayout.Height(100))) t += " \nAnd this is more text!"; EditorGUILayout.EndHorizontal(); if (GUILayout.Button("Clear")) t = ""; } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961