UI buttons don't work with Canvas Render Mode: Screen Space - Camera.
Hi!
I am facing an odd and annoying problem. For some reason UI buttons don't work when Canvas' rendering mode is Screen Space - Camera. I need to use this mode because I am displaying some 3D models along with UI elements, that's why I can't use Screen Space - Overlay. With Overlay mode buttons work fine, but 3D models are not visible. If I switch the mode at runtime, I will see that buttons are clickable(overlay), non-clickable(camera), clickable(overlay), non-clickable(camera).
I do have EventSystem and Standalone Mobile Input in my scene.
All the UI elements are in front of the camera(I tried putting them everywhere along Z-axis)
I tried setting all possible values of Order in Layer.
Buttons are on top of the canvas, so they are not covered with any other UI elements that are raycast targets.
Seems like I've tried all possible solutions that are listed in related threads. Thank you
Also facing this issue. Even when I open an empty scene, and only have a camera a button and the option of Screen Space - Camera. Surprised noone else encountered this yet, and that it's not fixed.
Answer by victorbisaev · Jan 29, 2018 at 01:01 AM
Check if have "Graphic Raycaster (Script)" attached to your Canvas.
Answer by tim_lol · Dec 23, 2019 at 11:28 PM
I had this issue when I had a script that inherited Image and overrode IsRaycastLocationValid
. Removing that made it work, so it could be that.