Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Scroll view not scrolling if initial touch is a button

Discussion in 'UGUI & TextMesh Pro' started by jtsmith1287, Jun 3, 2015.

  1. jtsmith1287

    jtsmith1287

    Joined:
    Aug 3, 2014
    Posts:
    787
    Things were working fine, and now I can't scroll my list unless I touch between the buttons in the list. So, I have to touch whitespace to scroll, otherwise it just thinks I'm trying to push the button. I don't think I changed anything and looking over settings nothing is popping out to me. Anyone know what might be causing this?
     
  2. jtsmith1287

    jtsmith1287

    Joined:
    Aug 3, 2014
    Posts:
    787
    This is also affecting the mouse wheel. If the cursor is hovering over a button I can't scroll. It only lets me scroll if the cursor is over the empty space in between the button in my content container for the scroll rect. Is this a bug or did I break something?
     
  3. iwillbenice

    iwillbenice

    Joined:
    Jun 7, 2013
    Posts:
    21
    Exactly same problem over here. Did you find some solution for this in the meantime?
     
  4. jtsmith1287

    jtsmith1287

    Joined:
    Aug 3, 2014
    Posts:
    787
    Nope, no solution yet. This might be a bug, which would be lovely. Too many show stopping bugs in Unity right now... *peaks over at Unreal engine...*
     
  5. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    what version are you using?

    did a quick test and it's working fine in 5.1.1f, scrollwheel, click drag etc. ... perhaps you can explain how you've got your canvas/scroll/buttons setup a little more completely so we can work out what's going wrong?
     
  6. jtsmith1287

    jtsmith1287

    Joined:
    Aug 3, 2014
    Posts:
    787
    The setup is exactly as it's shown in this tutorial. It has been working just fine for about a month now. It started requiring me to touch empty space to scroll shortly before I posted this. Since then I've updated to 5.1.0 and still doesn't work. I'll update to the most recent patch tonight and update this post.

    I've been up and down the inspector on every element related to the scrolling content and have seen nothing out of place, and since the time it was working I've not touched a thing. Hopefully the patch just fixes it.
     
  7. jtsmith1287

    jtsmith1287

    Joined:
    Aug 3, 2014
    Posts:
    787
    Updated to 5.1.1p2 and still not working. Here's screenshots of my setup.
    one.png two.png
    three.png
     
  8. Sprakle

    Sprakle

    Joined:
    Jun 8, 2013
    Posts:
    31
    Any updates on this? Seems to still be broken for me on 5.2.1p3
     
  9. jtsmith1287

    jtsmith1287

    Joined:
    Aug 3, 2014
    Posts:
    787
    Oh we totally fixed this. It was super simple, but I wasn't the one to fix it.

    If I'm remembering correctly we had the button script AND a pointer down event. One of the events was blank (no event registered) and once we removed the pointer down method (or maybe the button, don't remember) the problem was resolved. Hope that helps.
     
    pmuinos likes this.
  10. edwardwen

    edwardwen

    Joined:
    Jan 7, 2014
    Posts:
    1
    Use onClick event of button can resolve the problem.
    myButton.onClick.AddListener( () => {myFunctionForOnClickEvent("stringValue", 4.5f);} );
     
    pmuinos likes this.
  11. PZ2100

    PZ2100

    Joined:
    May 27, 2017
    Posts:
    21
    Same problem here. Apparently, if a button gets EventTriggerType.PointerEnter attached, scrolling won't work if drag started on that button.

    E.g. if you wanted to play a sound when mouse is over the button, you could do it this way:

    Code (CSharp):
    1. EventTrigger eventTrigger = button.gameObject.AddComponent<EventTrigger>();
    2. var eventType = new EventTrigger.Entry();
    3. eventType.eventID = EventTriggerType.PointerEnter;
    4. eventType.callback.AddListener((e) => audioSource.PlayOneShot(buttonMouseoverSound, 1f));
    5. eventTrigger.triggers.Add(eventType);
    However, this will make the button block scrolling of a parent ScrollRect. So, can't have both scrolling and mouseover sounds for buttons.

    I'd say it's a bug in Unity.
     
  12. esanuriana08

    esanuriana08

    Joined:
    Jan 10, 2021
    Posts:
    13

    Same problem and got solution.. Before, I using EventTrigger component for event click and then change to button and boom I am so happy :)

    Thanks for your clue