- Home /
Cannot click UI button.
I am working on Unity 5.4. I have an Event System, my UI has a parent canvas, Canvas has the graphic raycaster. I am not able to understand why this is not working. I have attached an image of the button script, Canvas, event system and my script. Thanks :)
Answer by Temseii · Sep 18, 2016 at 08:42 PM
Are you using curly brackets on line 16 and 19? Doesn't look like it, and there's an error there.
EDIT: Dunno if that's just the quality of the picture or why they look so weird, but on a closer look your error is on line 18. You're missing a quotation mark and the script isn't compiling.
Answer by WillNode · Sep 18, 2016 at 08:36 PM
Some theories of why this doesn't work:
Your code contains some compiler error
Your Button is Disabled
You uncheck (switching it off) the Interactable checkbox in the button
Nothing referenced in your button to any of your script
No image beside and inside (children of) that button, have a 'Raycast Target' turned on.
You have an image with 'Raycast Target' turned on, but it is disabled.
There existed 'Event Trigger' in any of the button's children, and it's enabled.
Something in front of and blocking your button (even it is fully transparent).
Answer by WanderlandGaming · Oct 11, 2016 at 05:22 AM
Just fell on something similar, and could reproduce the pattern.
Create a main canevas.
Inside this one, create a second canevas and put buttons inside. They are all active and work fine.
Add canevas scaler on the inner canevas. The buttons do not work anymore.
Remove the canevas scaler, it still does not work anymore. ,
Using 5.4.1f1
Answer by Zymurer · Nov 09, 2018 at 06:01 PM
Put a "//" at the beginning of line 17.
Maybe unity cannot send a message to the console after shutting (Application.Quit) the Application down.