0
\$\begingroup\$

I'm working on a card game that has quads with world space canvases on them. I've been using OnMouseOver() and Input.GetButtonDown(0) for detecting mouse clicks on the quad, but sometimes it seems the mouse click doesn't work when I'm over the quad. Now, I've checked multiple posts detailing different possible solutions to this question, but many of the raycast settings on the canvas and its children haven't produced results.

hierarchy window

game screenshot

\$\endgroup\$
3
  • 2
    \$\begingroup\$ "I've checked multiple...possible solutions" be sure to tell us which ones specifically, so we don't repeat one you've already tried. If the project looks superficially similar to these past Q&A threads, but those answers didn't work for you, it suggests there's something subtly different about your setup that me might not be able to glean from these two screenshots. To ensure we can give you accurate answers, try editing your question to walk us through the steps to create a sample of this problem in a new, empty project. That includes all relevant code and scene/inspector setup steps. \$\endgroup\$
    – DMGregory
    Commented Feb 22 at 0:59
  • \$\begingroup\$ It won't necessarily solve your problem, but you should really use the Input System package. The built-in Input API is poorly designed and outdated. \$\endgroup\$
    – Kevin
    Commented Feb 23 at 17:56
  • \$\begingroup\$ Select the EventSystem game object in your hierarchy and inside the inspector you will see EventSystem data you will see the pointer Enter , pointer Pressed and other such data. Maybe you will understand what object is blocking your raycast. \$\endgroup\$
    – Bogdan
    Commented Feb 25 at 0:23

1 Answer 1

0
\$\begingroup\$

I noticed the card hitboxes were working fine in the hand. The reason it wasn't working on the play field was because of the perspective; the card was being partially blocked by the slots in the playfield itself because of the perspective.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ How did you solve this occlusion problem? \$\endgroup\$
    – DMGregory
    Commented Feb 28 at 23:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .