Button not working when having a Slider as Child

Hi,
I have a button component which has several images and a Slider as childs.
The idea is the button can be click anywhere, it works ok if I click on the images, but when clicking on the slider it does not work.

How can I solve that?

Thanks

how do you want be able to interact with the slider if the click event was being passed to the button and not consumed by the slider? click without moving gets passed to the button but a drag interacts with the slider?

Hi,
I just one the reverse thing. The slider is not interactable. I want to click on the button not on the slider.

If your slider is a child of the button, then it’s drawn in front of the button, which means it will catch clicks instead. If you want it not to catch anything, you can disable the raycast on it.

Hi,
that is what I want however I have put the slider on the ignore raycast layer, but still seems to catch click (the button is not caching it).
How can I disable raycast on the slider and it’s childs?

You don’t need to add it to the layer. Just go to your slider and find all the “Raycast Target” checkboxes and uncheck them. This will allow your clicks to go through. Make sure you check each part of the slider as multiple parts may have the raycast target checkbox.

1 Like

Thanks! That worked!