- Home /
GUI.BeginScrollview
I'm trying to get the scroll bars to be shown all the time. Mainly I want the vertical, but to test it out i also added the horizontal as well. It flicks between the correct size to the the size of my screen.
void OnGUI(){ //Begin Scroll Slide scrollPosition = GUI.BeginScrollView(new Rect(10, 10, 800,600), scrollPosition, new Rect(0, 0, 220, 200), alwaysShowHorizontal:true, alwaysShowVertical:true);
//Add contect to the scroll area.
//Figure out how to shrink box and have words wrap correctly.
GUI.Box(new Rect(10, 10, 1300, 500), textAsset.text);
//Dend Scroll Slide
GUI.EndScrollView();
}
Is that the way to correctly us this? I looked at the Scripting Reference here, Did i do it wrong?
Answer by Mike 3 · Mar 12, 2011 at 07:56 PM
The second rect in your ScrollView should be the same size as your content, so (0, 0 1300, 500)
Another tip - I'd put the box (without text) outside of the scrollview, then put the text inside it as a TextArea instead. Should look a lot nicer like that
Thanks for the help. It was actually had to be the same as the orginal Scrollview. (0, 0, 800, 600) worked just fine.
Your answer
Follow this Question
Related Questions
How to make text that scrolls horizontally? 2 Answers
vertical scrolling, non editable text area. 1 Answer
Move the text in a GUI Button/Box 1 Answer
GUI.label overlapping text 1 Answer
Alpha not working in GUITex 0 Answers