Question by
Andrea_Marchetti · Jul 10, 2017 at 09:29 AM ·
buttoneventsystemscrollviewbutton trigger events
Buttons inside a Scroll View doesn't allow the the View to scroll.
Hey,
I have a list of buttons inside a scroll view I'd like the user to scroll. The problem is that if the touch starts from the button the scroll view doesn't recognise it as the scrolling start.
Is there an easy way to manage to touch to be considered as a button click only if it doesn't scroll?
Comment
Best Answer
Answer by Andrea_Marchetti · Jul 12, 2017 at 07:20 AM
Ok. I found out the problem was that I was using an events trigger for my buttons and that was absorbing all the inputs. So I found this link: http://answers.unity3d.com/questions/902929/scroll-not-working-when-elements-inside-have-click.html?childToView=907263#answer-907263
This is the easiest solution: (it may not work on mobile though, I have to try yet) using UnityEngine.EventSystems;
public class myClass : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
public void OnPointerDown (PointerEventData eventData) {
}
public void OnPointerUp (PointerEventData eventData) {
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612125912im_/https://answers.unity.com/themes/thub/images/avi.jpg)