|
Hello, How to set position in ScrollView? For example I have 300 buttons inside ScrollView and want to set position to make 200-th button visible.
(comments are locked)
|
|
You can use GUIStyle.CalcHeight to get the height of a line, then set the scrollview .y position to 200*calculatedHeight to go to the 200th button. Thanks! It's already can give what I need. But there is also some space between lines. In my case it is buttons and space between them. I see that it is 2 pixels, but can't find any variable inside GUIStyle where it could be. Is there a way to calculate it in script? Or may be it's always 2 pixels?
May 15 '10 at 09:49 PM
Santa
@Santa: Probably whatever the padding or margin is set to for the GUIStyle. However I think that's included in the CalcHeight maybe?
May 15 '10 at 10:27 PM
Eric5h5
No, it isn't in CalcHeight. Both Padding and Margin for the button GUIStyle has 4 in all values. And the space between two buttons is 2. I've checked it and one of them is what I need. I've tried to change both from 4 to 16 and got the result. BUT visually it is still 2 pixels, and mathematically I should use more. Interesting.
May 16 '10 at 07:34 PM
Santa
(comments are locked)
|
