Search Issue Tracker

Won't Fix

Votes

1

Found in

5.6.1f1

Issue ID

914014

Regression

No

Image.alphaHitTestMinimumThreshold not always registers correct raycasts when set to 1.0f

uGUI

-

To reproduce:
1. Open attached Unity project "AlphaHitTestProject.zip"
2. Open scene "testScene"
3. Go into play mode
4. Click on different places of "foregroundImage"
5. Observe the Console Window

Expected result: According to documentation, Image.alphaHitTestMinimumThreshold's value set to 1 would cause only fully opaque pixels to register raycast events on the Image. In other words, clicking on transparent (red colored) parts of the foregroundImage should result in BACKGROUND HIT console output and clicking on the opaque part (blue colored) should result in FOREGROUND HIT console output
Actual result: Clicking on most of the opaque space results in BACKGROUND HIT console output and clicking on some transparent space results in FOREGROUND HIT console output

Reproduced on: 5.5.3p3, 5.6.1p1, 2017.1.0b6

Comments (2)

  1. Be19ec28c5d597559cd03ec107d8e040?d=mm

    FunRobDev

    Jul 21, 2017 06:11

    Hi all, I found a solution, read my workaround here, which is also a kind of explanation for the coordinate shifting:

    https://forum.unity3d.com/threads/image-alphahittestminimumthreshold-not-working-correctly.465586/

  2. 6e29ca7a20f3643ec688b248cd7198b8?d=mm

    ariesdev

    Jun 20, 2017 11:54

    Hi,
    I don't know if it's related to the same issue, but alphaHitTestMinimumThreshold seems to not work properly, as if tested coordinates are shifted. Someone even succeeded to make it work by setting opaque pixels in bottom/left and top/left corner of original image (?).

    More information on this post (especially on the end) : https://forum.unity3d.com/threads/image-alphahittestminimumthreshold-not-working-correctly.465586/

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.