3

I have a ScrollView with a ScrollRect on a Panel that appears when an object is clicked. The Content has a ContentSizeFitter and a GridLayoutGroup with 3 columns. I have 9 images pre-populated as children of Content. Everything works great, the 9 images create a 3x3 grid which can be scrolled vertically as intended. The problem is the only way it will scroll is to use the mouse wheel. Clicking/dragging the ScrollBar handle indicates that the handle has been clicked (i.e. it darkens as selected), but it doesn't move/scroll. Same issue when deploying to a touchscreen device (except there's no mouse wheel, so can't scroll at all).

Any ideas?

Here are some screen shots of my setup:

ScrollView - Inspector

Content - Inspector

pandron
  • 43
  • 1
  • 8
  • 1
    Do you have anything in the hierarchy that overlaps the scrollview and maybe hinders interaction with it? – Skdy Aug 17 '20 at 11:28
  • @Skdy I don't THINK so... I tried moving MyScrollView to the bottom of the stack, but it didn't seem to make a difference. Notably, when I click on the SliderBar in the Game window while running the app the bar registers that I have clicked on it (goes grey), but I can't drag it. – pandron Aug 17 '20 at 22:17
  • 1
    Does scrolling work by dragging the content on mobile or desktop? Could you create a new default scrollrect and check if that work? – JeanLuc Aug 18 '20 at 19:54
  • @JeanLuc Good troubleshooting suggestions. No, scrolling does not work by dragging the content on either mobile or desktop. I just now created a default generic ScrollView, added a generic text box to the content, made sure it had plenty of text. Same problem with the new ScrollView. Scrolls with mouse wheel no prob, but not with bar or click-drag. – pandron Aug 20 '20 at 17:09
  • 1
    Maybe try in a new project with the same unity version. Could you also check the value of Drag Threshold in your EventSystem? It should be about 10 Pixel. – JeanLuc Aug 21 '20 at 21:27
  • @JeanLuc If I add a ScrollView to the scene directly it DOES scroll. But the ones on this PreFab shown here DO NOT scroll. (Drag Threshold is 5 btw, but I changed it to 10 with no effect). If I monitor the EventSystem when running the app in Unity it registers "pointerPress: Scrollbar Vertical (UnityEngine.GameObject)" but I still can't move the Scrollbar. – pandron Aug 30 '20 at 17:02
  • the prefab vs regular GameObject difference is odd. could share a minimal reproducible example of the odd prefab situation? you could also share it as bug report to unity. https://unity3d.com/unity/qa/bug-reporting – JeanLuc Aug 30 '20 at 21:02
  • I solved the problem. I had the z-position of the Canvas on my PreFab set to -100 (my INCORRECT thinking was that I wanted it to show up on TOP of other canvases). That position effectively set the canvas behind the camera which confused the ray tracing system. Setting the z-position of the Canvas to zero solved the problem. – pandron Sep 08 '20 at 17:31
  • @pandron thank you so much!! I had been bashing my head against this exact issue for 3 hours until I read this and noticed my instantiated scrollview got set to z -450, setting to 0 fixed it. This still doesn't make super clear sense to me because the rendering camera is at -2000 so I don't know why this is an issue. – gregoryb May 07 '21 at 01:57

0 Answers0