Draw widget element when looking at actor (interaction)

Hlo. How to properly make widget element appear only when looking at interactable actor (door, pickup item, etc.)?
I could do it with traces, constantly (every frame) shooting to check is there an object in front of player at particular distance, but i doubt that this is performance wise

I could do it with traces

This is the way.

Tracing is incredibly performant, you can afford couple (hundred) of those every tick. You could always run a trace on a timer instead - 10x per second may be enough. I would not worry about about this particular aspect of performance, though.