Version: 2022.3
言語: 日本語

ScrollViewScope

class in UnityEditor

マニュアルに切り替える

説明

BeginScrollView / EndScrollView を管理する Disposable ヘルパークラス

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 = ""; } }

変数

handleScrollWheelこの ScrollView がスクロールホイールイベントを処理するかどうか(デフォルトは true )
scrollPositionThe 変更された scrollPosition 。例にあるように戻り値として得た値は変数に渡します。

コンストラクタ

EditorGUILayout.ScrollViewScope新しい ScrollViewScope を作成し、対応する ScrollView を開始します。