Search Unity

[SOLVED] Scroll Rect allowing objects to be clicked regardless of being outside Rect

Discussion in 'UGUI & TextMesh Pro' started by SP33, Oct 3, 2015.

  1. SP33

    SP33

    Joined:
    Oct 3, 2015
    Posts:
    3
    I have a Scroll Rect which contains a mask so the content doesn't overflow onto the rest of my gui. I also have a child which contains a Content Size Fitter and a Grid Layout Group so I can instantiate objects to display within the scroll region. Then below the scroll rect on my GUI I have a few buttons, the problem starts when I add enough objects to the Scroll Rect they would overflow on top of the buttons below the Scroll Rect. The mask prevents this happening visually but when I go to click my buttons, unity is clicking the objects in my Scroll Rect instead. I read this is a bug and to update to Unity 5.2.1p1 so I did, and I still have this issue. I attached an example below.

    exampleUI.png
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    I cant see any mention in the release notes for 5.2.1p1 or 5.2.1p2 of this being fixed. Do you have a bug number or issue tracker link I can look at?
     
  3. SP33

    SP33

    Joined:
    Oct 3, 2015
    Posts:
    3
    My apologize, I may be assuming it is related to another issue I read about. This is the thread where someone had an issue with UI buttons being ignored and clicks interacting with objects below it. So my first instinct was to try and upgrade to Unity 5.2.1p1 which was supposed to solve his specific issue but clearly it was not the same as mine.
    http://forum.unity3d.com/threads/upgrading-to-unity-5-2-ui-problem-with-raycast-target.353586/

    Am I correct in assuming objects in a masked Scroll Rect should not be interactable if not in view? I tried checking whether the Click was within the Scroll Rect and only continuing if so but it did not seem to work.
     
  4. SP33

    SP33

    Joined:
    Oct 3, 2015
    Posts:
    3
    I was able to fix my issue, I was using UI images instead of buttons for certain objects and no matter if they are hidden in a scroll rect or not you can still click those. I switched them over to UI buttons, updated the code a bit and it was fixed. Seemed it was my error, I thought it wouldn't make a difference if I was using a button or image.
     
    Saicopate and karl_jones like this.