How do I stop a VisualElement from intercepting mouse event?

I have some VisualElement drawn over Buttons and they are blocking the Buttons from being pressed. These VisualElements just have height, width and background image they are not subclasses. Even if I do not set the background Image but just the height and width they block the buttons underneath them. Is there a way to stop them from intercepting mouseclicks?

Setting yourElement.pickingMode = PickingMode.Ignore; should do the trick. You can set this in UXML as well with picking-mode="Ignore"

2 Likes

Thanks. Are there plans to include it in .uss “picking-mode: ignore;” in the future?

No plans to make it a style property right now as it affects functionality of elements a bit too much so we don’t want it to be too easy to change.

1 Like