#UI Buttons don't match their hitbox

1 messages · Page 1 of 1 (latest)

sand zenith
#

I'm trying to make a Point & Click game where items can be clicked on and added to your inventory to be dragged out & hit Collider Triggers to trigger effects, so every Canvas is a world space.
However, the UI Buttons don't match their hitboxes - seen in the vid below.

slim kite
#

Continue debugging with EventSystem as you were recommended and find out what is blocking raycast

#

Event system data is on the bottom of its inspector at runtime, you might need to extend it

sand zenith
slim kite
#

Then image border is being overridden. Normaly it just uses image boundaries

#

Check if Raycast Padding on Image component was changed

#

Also make sure your canvas boundary actually exists there

sand zenith
#

image settings for comparison

#

ok weirdly enough when i altered the anchor transform by pressing shift and clicked on the center middle option, i could now hover over her sprite and it would ALSO light up on hover, while th efeet hitbox remained the same

#

the sprite looked like this for comparison

slim kite
#

Shift I think would center to the current container.

#

Anchor boundaries should not affect image clickable boundaries

#

As long as it's inside canvas area

velvet dirge
slim kite
#

Do a simple check to see if it's your button misconfigured. - Create a default button and move it around including into unclickable area.

sand zenith
slim kite
#

They are using them in worldspace canvas

sand zenith
#

i`m using world space canvases

velvet dirge
#

Is that normal? Doesn't Graphic Raycaster work with Graphics just fine without colliders in world space?

slim kite
#

Which is another thing why I asked to state what are you actually need them for, because you can do things differently inside canvas.

velvet dirge
#

GraphicRaycaster ignores physics colliders anyway

#

If you have a PhysicsRaycaster2D then you could detect them with the physics colliders

#

but if not, the physics colliders will do nothing

slim kite
#

I surmised this was needed for draggable things to collide and trigger. Which is again. better ways to do inside UI.

slim kite
sand zenith
sand zenith
velvet dirge
#

Graphic raycaster goes on the canvas

#

physics raycasters go on the camera

slim kite
sand zenith
#

yeah its there

velvet dirge
#

Silly question btw - do you have more than one camera? And is the camera perspective or orthogonal?

sand zenith
#

only one camera

slim kite
#

It's strange then EventSystem didn't tell you about blocking events.

sand zenith
#

oddly enough it seems to be -9 on the Z axis....

#

and when i put it on 0 it only shows the shadow

velvet dirge
#

for the camera? Yeah it's normal for it to be at -10

sand zenith
#

oh ok

velvet dirge
#

you need the camera positioned back a bit so it can see the objects that are at 0

slim kite
#

You should put canvas back to screen space and use only physics raycaster if you want interactable sprites. (Or if you want it to be in UI, use Canvas for everything and remove physics raycaster interactions)

#

Otherwise you need to track priority which one should be blocking and which one passing events to overlapping elements under it...

sand zenith
#

ok weirdly enough

#

i figured out how to fix the issue

#

... Sort of

#

it seems to be caused by yarnspinner's dialoguerunner's canvas

#

which is weird,

#

because it's an overlay canvas

velvet dirge
#

why is that weird

#

you would expect the overlay canvas to get first dibs in the event system, since it's always on top

sand zenith
#

bc the other canvas are in world space

velvet dirge
#

yeah that's working as expected.

sand zenith
#

and more importantly the dialogue boxes arent immediately active so it just confuses me is all