I’d like to have a small button with a larger collision area.
So I’ve got a parent rectTransform (128w128h) with eventTrigger. and a child Image (6464) .
The event trigger only works when I actually click inside the image. doesn’t work inside the rectTransform if it’s outside the image.
If it was NGUI I would add a boxCollision to the parent and that would work. What’s the equivalent in the new UI system.
Right now as a hack, I’ve added a Text component to the parent rectTransform with no text on it. and that works. But I assume there is a better way.
Thanks
Our raycasters work against graphics (not rect transforms). As such you need a graphic present to receive evens. We may change this in the future, but not for the first release.
Thanks for the quick respond.
I definitely see the advantage of reycasting against graphics and it totally make sense.
But having a larger collision box to capture iphone touches is a fairly common practice. I’m ok using an empty Text component to receive the events.
Can you think of a better way to get around that?
I would use an image, and set the alpha to 0, it won’t be rendered at all then and should work nice and fast
I was not sure if it’s gonna create a fill rate issue, but sounds like it optimized. Good to know
Thank you.