Version: 2022.1
언어: 한국어

ScrollViewScope

class in UnityEditor

매뉴얼로 전환

설명

Disposable helper class for managing BeginScrollView / EndScrollView.

These work just like ScrollViewScope but feel more application-like and should be used in the editor


Label inside a scroll view.

using UnityEngine;
using UnityEditor;

// Simple Editor Window that creates a scroll view with a Label inside class BeginEndScrollView : EditorWindow { Vector2 scrollPos; string t = "This is a string inside a Scroll view!";

[MenuItem("Examples/Write text on ScrollView")] static void Init() { var window = GetWindow<BeginEndScrollView>(); window.Show(); }

void OnGUI() { using (var h = new EditorGUILayout.HorizontalScope()) { using (var scrollView = new EditorGUILayout.ScrollViewScope(scrollPos, GUILayout.Width(100), GUILayout.Height(100))) { scrollPos = scrollView.scrollPosition; GUILayout.Label(t); } if (GUILayout.Button("Add More Text", GUILayout.Width(100), GUILayout.Height(100))) t += " \nAnd this is more text!"; } if (GUILayout.Button("Clear")) t = ""; } }

변수

handleScrollWheelWhether this ScrollView should handle scroll wheel events. (default: true).
scrollPositionThe modified scrollPosition. Feed this back into the variable you pass in, as shown in the example.

생성자

EditorGUILayout.ScrollViewScopeCreate a new ScrollViewScope and begin the corresponding ScrollView.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961