- Home /
Buttons in UI Scroll Rect
Hi.
Does anyone know how to make buttons within a Scroll Rect interactible?
My setup is this: ScrollRect > Panel > Buttons.
The panel has a Canvas Group.
If I turn on raycast blocking the buttons work but I can't scroll.
If I turn off raycast blocking the buttons don't work, but I can scroll the list.
How do you fix this?
Answer by giano574 · May 05, 2015 at 03:08 PM
It turns out it was the Event Triggers on my buttons that caused the problems. The thing is, my buttons consists of text only, so I want the text (child GameObject) to change color when the button is pressed.
Does anyone know how to do this without using OnPointerDown/OnPointerUp?
You can use onClick or if you use animations in button then you can alter the animation to change text color. There is also On$$anonymous$$ouseDown/Up way, but I don't thinks you'd want to use that.
OnClick fires after you let the button go.
Animations was the way to go. Thank you very much.
Answer by DoTA_KAMIKADzE · May 05, 2015 at 02:37 PM
Interactable and BlocksRaycasts should be on if you want your button to work as expected. HERE you can check how to create ScrollRect. You can read about CanvasGroup options HERE.
P.S. If after those^ you will still have problems then provide settings (screenshots or write down if you want so) of your ScrollRect, your Panel-CanvasGroup container and your Button.