- Home /
GUI scrollbar help!
i have found a scrip of the Vertical Scrollbar. But i'm kind of confused where to put the content of the scrollbar? like texts and images that can be scrolled vertically
here's the gui part of my code
function OnGUI() { GUI.skin = customSkin; if(openWindow) {
GUI.Window(0,Rect(x,y,700,500),InstructionWin,"INSTRUCTIONS");
} }
function InstructionWin(windowID:int) { sbar=GUI.VerticalScrollbar (Rect (25, 100, 100, 200), sbar, 1.0, 0.0, 10.0); if(GUI.Button(Rect(82,200,200,20),"BACK"))
{ openWindow=false; }
}
function OnMouseUp() { openWindow=true; }
Answer by Demigiant · Feb 27, 2011 at 10:10 AM
If you don't want a simple scrollbar, but an area which can scroll some content, you should use GUILayout.BeginScrollView() instead:
var scrollPos:Vector2;
function OnGUI() {
GUILayout.BeginScrollView( scrollPos ); // Starts the scrolled area
// GUI contents that need to be scrolled
GUILayout.EndScrollView(); // Ends the scrolled area
}
Your answer
Follow this Question
Related Questions
ScrollView not....scrolling. 2 Answers
How to make a scroll bar work? 1 Answer
Can I customize my scrollbar in the GUI.BeginScrollviewFunction? 0 Answers