Search Issue Tracker

Active

Under Consideration for 2022.3.X, 6000.0.X, 6000.1.X, 6000.2.X, 6000.3.X

Votes

1

Found in

2022.3.62f1

6000.0.52f1

6000.1.11f1

6000.2.0b9

6000.3.0a1

Issue ID

UUM-110769

Regression

No

Child image does not trigger an event when the parent image is using alphaHitTestMinimumThreshold > 0

-

Reproduction steps:
1. Open the attached project "ReproProj"
2. Open the “/Assets/UnclickableButton.unity” Scene
3. Enter the Play Mode
4. Observe that the “X“ component can be clicked
5. Try clicking the component on the lower left of the “X“ component

Expected result: The component on the lower left is clickable
Actual result: The component cannot be clicked

Reproducible with: 2022.3.62f1, 6000.0.52f1, 6000.1.11f1, 6000.2.0b9, 6000.3.0a1

Reproducible on:
Play Mode
Windows Standalone Player

Testing environment: Windows 10 Enterprise 21H2
Not reproducible on: No other environment tested

Notes:
- In Windows Standalone Player, the component on the lower left of the “X“ component also appears as “X“, but in Play Mode, that component appears as the white square

Comments (1)

  1. hurleybird

    Jul 04, 2025 03:53

    "In Windows Standalone Player, the component on the lower left of the “X“ component also appears as “X“, but in Play Mode, that component appears as the white square"

    Oh, that's probably nothing. Guessing one is the "default" scene, while the other is the "example" scene. I would have changed child Image to the default, without using a sprite, just to remove that variable.

    So the problem is in Image.IsRaycastLocationValid

    This method early outs whenever you aren't trying to do anything with transparency. So if alphaHitTestMinimumThreshold is at the default 0, it just returns true.

    As the input system crawls through the UI hierarchy, it stops as soon as an ICanvasRaycastFilter.IsRaycastLocationValid returns false.

    The child Image cannot be clicked because the proper behavior for Image.IsRaycastLocationValid *should* be to always return true when the screenPos is outside the Image Rect bounds (and this would mirror the behavior of when alphaHitTestMinimumThreshold == 0), but instead it will sample the nearest texel, and return true when that value is below alphaHitTestMinimumThreshold.

    So the interactability of the child Image is determined by the alpha value of the nearest texel in the parent—an absurd behavior that can not possibly be intentional.

    Don't be confused by:

    if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, screenPoint, eventCamera, out local))
    return false;

    in Image.IsRaycastLocationValid. While this implies that check fails when the screenPoint is outside of the Image Rect, that method actually only returns false when the screenPoint lies outside the Image Rect *Plane*, not its bounds.

    Absent a more substantial refactoring, after the aforementioned lines, but before:

    return activeSprite.texture.GetPixelBilinear(x, y).a >= alphaHitTestMinimumThreshold;

    the method *must* check whether screenPoint is outside of the Image Rect *bounds*, and return true when that is the case.

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.