Problem with widget visibility when using raycast.

Hi,

For my FPP game I’m trying to reproduce an interaction widget which has to work in a similar way you can see it in many games. Once my crosshair is on an interactable objet (and I’m close enough) a widget should appear on the screen.

For now I’m using raycast within my character Blueprint to “search” for objects with a certain interface to turn the widget on and Event Tick inside my widget to turn it off. When it comes to enabling/disabling input and turning ‘render custom depth’ on and off this approach works fine.

For some reason with the same setup my widget appears whenever raycast hits any object, not only the ones with appropriate widget interface.

This might seem easy and I’ve seen many games do that with UE, but I must be doing something wrong.

Screenshots attached.