- Home /
Is it possible to configure raycast to hit opaque pixels without using alphaHitTestMinimumThreshold?
I have not rectangular HUD in my game. I want to disable clicks through opaque parts of UI and enable through transparent. I made it using alphaHitTestMinimumThreshold, but I don't like this solution because it is necessary to enable read/write on adding a new sprite. Is it possible to configure raycast to hit opaque pixels without using alphaHitTestMinimumThreshold?
Answer by Zaeran · Nov 05, 2019 at 03:32 PM
It's only really possible with read/write enabled unfortunately.
Because the UI system doesn't use Colliders, it has to actually test the pixel of the sprite that you click on to see if it is or isn't opaque.
In order to get around the issue, you'd have to write your own UI raycast and collision system, which is a lot more work than enabling 'read/write' on each sprite.