Changing the size/dimensions of a button's bounding box

Turns out that the reason for the problem in my previous post is that the bounding boxes for my UI buttons are too large, and therefore, when I try to click on a tile, sometimes that results in an invisible portion of one of my buttons being clicked instead.

How do I change the bounding box of a button element? Does it have something to do with the group that it’s in? Or the 2D screen? I’ve been tooling around with as many settings as I can find, but nothing seems to fix it.

As you can see, the bounding box on this button, for example, is way too wide. Why isn’t it equal to the size of the button itself, and how do I fix it?

Can you post a public project with this problem please? Usually it’s because the the boundary is based off the image size so if you have an button image with transparent borders, it will need trimming/cropping.

1 Like

https://playcanvas.com/project/600366/overview/eta-play-mode

also, here is how the button images look in my file explorer. I don’t see how they could be cropped any further than they already are.

On a hunch, I checked the width/height of my button images. And it turns out that some of the button images are nearly 700 pixels wide: the same width as the bounding box: image

I want the buttons to only be 75 pixels wide, so I’ll have to remake the images. Thanks for the tip, yaustar!

Okay, I edited all the images so that they’re only 75px by 75px, re-uploaded them, and reassigned the button textures. But the problem persists. I’ll keep trying to monkey around with it, but it looks like I haven’t accomplished much.

I guess I’m assuming that my problem is being caused by the bounding box being too wide. If that’s the case, then this is what I want to do:

Are you still having this problem? I’m not able to replicate it?

On a side note, I’ve fixed the issue of clicking the button also selecting a square in the model view:

https://playcanvas.com/editor/scene/717277
https://playcanvas.com/editor/code/604434?tabs=17853118

Look at the script added to the buttons.

Feb-23-2019%2023-17-49

I’m also not able to replicate the problem with the buttons being randomly selected, either. Strange.

Thanks for the help with the buttons. I really appreciate it!