- backgroundColor
- BeginGroup
- BeginScrollView
- Box
- BringWindowToBack
- BringWindowToFront
- Button
- changed
- color
- contentColor
- depth
- DragWindow
- DrawTexture
- enabled
- EndGroup
- EndScrollView
- FocusControl
- FocusWindow
- GetNameOfFocusedControl
- GUI
- HorizontalScrollbar
- HorizontalSlider
- Label
- matrix
- PasswordField
- RepeatButton
- ScrollTo
- SelectionGrid
- SetNextControlName
- skin
- TextArea
- TextField
- Toggle
- Toolbar
- tooltip
- UnfocusWindow
- VerticalScrollbar
- VerticalSlider
- Window
GUI.BeginScrollView 开始滚动视图
static function BeginScrollView (position : Rect, scrollPosition : Vector2, viewRect : Rect) : Vector2
static function BeginScrollView (position : Rect, scrollPosition : Vector2, viewRect : Rect, alwaysShowHorizontal : bool, alwaysShowVertical : bool) : Vector2
static function BeginScrollView (position : Rect, scrollPosition : Vector2, viewRect : Rect, horizontalScrollbar : GUIStyle, verticalScrollbar : GUIStyle) : Vector2
static function BeginScrollView (position : Rect, scrollPosition : Vector2, viewRect : Rect, alwaysShowHorizontal : bool, alwaysShowVertical : bool, horizontalScrollbar : GUIStyle, verticalScrollbar : GUIStyle) : Vector2
Parameters参数
- positionRectangle on the screen to use for the ScrollView.
用于滚动视图在屏幕上矩形的位置 - scrollPositionThe position to use display.
用来显示滚动位置
- viewRectThe rectangle used inside the scrollview.
滚动视图内使用的矩形 - alwayShowHorizontalOptional parameter to always show the horizontal scrollbar. If false or left out, it is only shown when clientRect is wider than position.
可选参数,总是显示水平滚动条,如果false或者不设置,它仅在内矩形比外矩形大的时候显示。 - alwayShowVerticalOptional parameter to always show the vertical scrollbar. If false or left out, it is only shown when clientRect is taller than position.
可选参数,总是显示垂直滚动条,如果false或者不设置,它仅在内矩形比外矩形大的时候显示。 - horizontalScrollbarOptional GUIStyle to use for the horizontal scrollbar. If left out, the horizontalScrollbar style from the current GUISkin is used.
用于水平滚动条的可选GUIStyle,如果不设置,水平滚动条样式应用当前的GUISkin皮肤。 - verticalScrollbarOptional GUIStyle to use for the vertical scrollbar. If left out, the verticalScrollbar style from the current GUISkin is used.
用于垂直滚动条的可选GUIStyle,如果不设置,垂直滚动条样式应用当前的GUISkin皮肤。
Vector2 - The modified scrollPosition. Feed this back into the variable you pass in, as shown in the example.
返回Vector2类型,被修改的滚动位置scrollPosition。返回值应回传给你的变量,看下面的例子。
Description描述
Begin a scrolling view inside your GUI.
在你的GUI里,开始一个滚动视图, 注意BeginScrollView和EndScrollView它们是成对出现的。
ScrollViews let you make a smaller area on-screen look 'into' a much larger area, using scrollbars placed on the sides of the ScrollView.
滚动视图让你在屏幕上一个小的区域,使用滚动是视图的滚动条查看一个大的区域。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public Vector2 scrollPosition = Vector2.zero;
void OnGUI() {
scrollPosition = GUI.BeginScrollView(new Rect(10, 300, 100, 100), scrollPosition, new Rect(0, 0, 220, 200));
GUI.Button(new Rect(0, 0, 100, 20), "Top-left");
GUI.Button(new Rect(120, 0, 100, 20), "Top-right");
GUI.Button(new Rect(0, 180, 100, 20), "Bottom-left");
GUI.Button(new Rect(120, 180, 100, 20), "Bottom-right");
GUI.EndScrollView();
}
}
//定义默认的滚动条位置为0,0
var scrollPosition : Vector2 = Vector2.zero;
function OnGUI () {
//我们创建一个100,100的滚动视图,滚动内容为220,200,就是我们要查看的内容比滚动视图大
scrollPosition = GUI.BeginScrollView (Rect (10,300,100,100),scrollPosition, Rect (0, 0, 220, 200));
// 我们创建一个100,100的滚动视图,滚动内容为220,200,就是我们要查看的内容比滚动视图大
// 返回值赋回给我们定义的变量
GUI.Button (Rect (0,0,100,20), "Top-left");
GUI.Button (Rect (120,0,100,20), "Top-right");
GUI.Button (Rect (0,180,100,20), "Bottom-left");
GUI.Button (Rect (120,180,100,20), "Bottom-right");
// 结束滚动视图
GUI.EndScrollView ();
}