I’m tempted to suggest keeping the widget hidden until you have line of sight, but if its purpose is to help the player find the object, I get a bit confused…a screenshot of the problem scenario along with maybe like a mockup of the correct functionality might help. Probably just me not understanding anyhow…
With my visibility suggestion, I would say to use something like a line trace to reference the player having line of sight, thus enabling visibility.