0
\$\begingroup\$

I made a GUI Tool for Unity I tryed to add ScrollView like this before the for loop that creates GameObject buttons :

scrollPosition = GUI.BeginScrollView(new Rect(Screen.width-1,20,0,Screen.height-60),scrollPosition,new Rect(0,0,Screen.width-20, Screen.height-80),false,false,GUIStyle.none,GUI.skin.verticalScrollbar);

and I use GUI.EndScrollView after the for loop that creates Buttons

\$\endgroup\$
6
  • \$\begingroup\$ The code you have linked does not include a call to BeginScrollView. What are the observable symptoms when you add these calls? \$\endgroup\$
    – DMGregory
    Apr 25, 2021 at 16:50
  • \$\begingroup\$ Now It's In the Link. also, all i noticed is that a Rect has been created on top of my buttons. \$\endgroup\$
    – TensaDev
    Apr 25, 2021 at 17:39
  • \$\begingroup\$ i verified those buttons are saved and instanciated as they should only scrollview creates some sort of layer on top of them if I add Buttons they're added but everything hidden in the back. Also, the scrollHandler doesn't become tinier if i add a bunch of buttons that means that they're not included in scrollalble area \$\endgroup\$
    – TensaDev
    Apr 26, 2021 at 6:07
  • \$\begingroup\$ I notice you deleted your question. If you've solved your issue, would you like to instead post your solution as an Answer that can help future developers struggling with scroll views? \$\endgroup\$
    – DMGregory
    Apr 26, 2021 at 12:42
  • \$\begingroup\$ it was just a stupid mistake i made, i believe. i only replaced Screen.width-1 with 0 and it was solved. i did not reade the description well. i think no one would make such a mistake. That's why i deleted it. You think i should keep it? \$\endgroup\$
    – TensaDev
    Apr 26, 2021 at 17:15

1 Answer 1

1
\$\begingroup\$

I misread the definition of ScrollView. The first Rect defines the Rectangle on the screen to use for the ScrollView. and the Second is the rectangle used inside the scrollview. that means that i should not position ScreenWidth-1 which makes it hidden from me

In other words, i should replace Screen.width-1 with 0

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .