- Home /
UI - click through image
Hi, I've got this problem because between my mouse and button is image. So when i click on button they do nothing. I think i must make image non-blocking or something but i have no idea how to do that.
Answer by Mmmpies · Dec 23, 2014 at 10:01 PM
You could set a CanvasGroup on the image and uncheck blocksRaycast and interactable.
Just select the image and click AddComponent -> CanvasGroup. (sorry no idea if you know how to do this already).
Should still be visible if the alpha = 1.
Answer by Carlotes247 · Dec 21, 2015 at 02:58 AM
Didn't work. Neither did setting the layer to "Ignore Raycast." Very curious.
First of all, thank you for your solution - I am using it 5 years later haha!
I am not quite sure how CanvasGroups work, but this solution has served me better:
I had an empty game object (let's call it Layer X), that I wanted to instantiate objects on - so that they are always first in the hierarchy. Since the CanvasGroup will affect all children of the object, it blocked interaction with the objects I have instantiated on LayerX.
For anyone having the same problem, just toggle the Raycast Target on the image off - you can also switch it back on in runtime so that's perfect for these kind of scenarios
Your answer
Follow this Question
Related Questions
Stop clicking through a GUI window 2 Answers
Cannot click on image multiple times 0 Answers
Change sprite images on button click 0 Answers
GUI Repeatbutton up? 1 Answer
Unity UI Button not working 1 Answer