Scrollbar Issues

Hey guys

So I’m trying to implement a few scrollbars into one of my systems’ UI, but I have a few issues I’m struggling to figure out on my own:

  1. The scrollbar is visible in Edit mode, but it disappears (i.e: it self-turns itself off) during gameplay, and I have no idea why (and toggling it back on doesn’t bring it back either). Here’s a screenshot of what I mean:

No matter how hard I click, this toggle for some reason absolutely refuses to work (as if some Update function commanded it to go false, not sure… just a wild guess)

  1. One of my scrollbars needs my mouse to be extremely close to it, or it won’t scroll. I have no idea why it’s acting like this. I’ll attach some screenshots to explain what I mean:

If it’s in the red zone, yes it works. In the blue zone, where I expect it to work, no it doesn’t work

Where have I gone wrong for these two issues?

If there is nothing to scroll (in other words, if the contents to not exceed the size of the scrollbar area, then the vertical scrollbar is disabled automatically.

As far as the behavior of the scrollbar, welcome to Unity scrollbars… That’s pretty much how they behave for me as well.

well I did exceed the text length on purpose to test it out, but I was surprised to realize that whilst the text does hide for us to be able to scroll it, the scrollbar never actually showed up (as you can tell by the first screenshot), and I’m extremely confused as of why the toggle for that thing won’t work (again, first screenshot main issue)

I’m not sure what @bixarrio did (I borrowed his Crafting system), but for the inventory, this issue does not exist, although the settings are literally the exact same. I was hoping this issue would go away when the game is built, but it still exists unfortunately… :sweat_smile:

The ScrollRect has options to define how the scrollbars should behave
image
I didn’t change the default because in my tests I never had enough items to exceed the box. You may want to change it to whatever suits your needs.

I think it’s the default behaviour of the ScrollRect. It wants to be Elastic.
image
This means you can click on the ‘blue area’ and drag the contents up and down (the whole thing, not individual items). It also only responds to the drag if it’s over an empty spot, so once the viewport is full (or overflows) there is hardly anywhere you can click to drag it around. A little annoying, I know. Changing it changes how the elastic works, but it’s still a drag behaviour.
Also, you don’t have an EventSystem in the hierarchy (at least not in the copy I had to do the crafting system). I added one and could see that - for some reason that’s not obvious - the recipe name overflows the scrollbar so clicking on the scrollbar actually selects the recipe. Only on the very right of the scrollbar are you not over the recipe and can actually click the scrollbar (and somewhere in between is the viewport which ‘scrolls’ in the opposite direction because you are ‘elastic dragging’ the content). Looking at the individual recipe prefabs, they look fine so I’m not sure how the EventSystem is picking up the recipe name. I think it has to have something to do with the way the UI scales because at different scales in the game view, this overlap changes. I don’t know how to fix it.

Well I did change the visibility to permanent, and whilst that got it to show, now it’s not scrolling… Any idea where did I possibly go wrong?

So there’s no way around this…? :sweat_smile:

I think I’ve seen Synty recently address this in their videos for their new HUD display setup, where they set the scale to be fixed

Hmm… so there’s no way to scroll even when hovering over Recipes? I still have no clue how you got it to work correctly with the inventory but not recipes, although they look very similar

Sure there is… switch to UI Elements (the new UI system). It works MUCH better. My Spellbound Hunter game uses the new UI exclusively.
However, it’s a -=lot=- more work. That tutorial is still sitting in my “someday” bin.

might give this a go sometime down the line (for now though I’m still trying to implement new systems, let’s just hope we don’t screw things up by accident) :slight_smile:

Privacy & Terms