- Home /
Scrollbar with Ortho-GUI
In my project, I'm using the ortho camera method for my GUI, and I'm coming to a point where I need a scrollbar in my GUI. I realize there's already a scrollbar option in the standard GUI, but that won't work for this project.
In my head, the only way I can think of it working is to use a basic mouse drag on the slider (or arrow keys, or whatnot) and have it register what percent of the bar it's at and then translate that to the window it's scrolling. What I can't figure out is how to dynamically determine any of it -- I could hardcode in things by pixel, which would work for the slider, but the window it will be controlling will be populated with various sizes of strings.
Any suggestions?
I was having an issue where things I would click in the GUI and the click would carry over into the world, as well. The fastest solution was the orthographic camera GUI. Also, I didn't want to deal with positioning the GUI in code -- I wanted to feel it out in real time.
I would use GUI.BeginScrollView() and solve the mouse click problem separately. You'll always need to prevent GUI clicks from carrying over into the world, won't you?
Here's a couple places to start: http://answers.unity3d.com/questions/27320/ignoring-raycasts-hitting-gui.html http://answers.unity3d.com/questions/16774/preventing-mouse-clicks-from-passing-through-gui-c.html
Your answer
Follow this Question
Related Questions
Show content with scrollbar? 2 Answers
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