Dynamically Change Widget Text Based on What is Being Looked At

So, I have a line trace running off Event Tick (I know a lot of people don’t like it, but for the purposes of the animation effect we’re achieving, I feel it’s necessary).

And following is my blueprint script to run this:

My question is how to dynamically change the text within the widget to reflect what the character is looking at (or what input method they’re using, such as switching ‘E’ for an Xbox “X” button PNG)

E.G. If looking at a door, the text should read “‘E’ to open door”. If looking at an item that’s able to be picked up, it should say “‘E’ to pick up”.

I assume I can do this using gameplay tags, but I don’t know enough about them to implement them yet, so I was wondering if someone could help enlighten me a bit. I did a bit of searching on the internet, and couldn’t find much info on how to have dynamically changing text based on a line trace hit.

I usually do this with Interfaces. Interactables get their own interface. In the interface you can create a function that returns a display string. This is also handy for being able to interact with all types of things regardless of their base class as you can make an implementable event with the Interface as well.

The hit actor blueprint would implement this interface and as long as you have an actor reference to whatever you are linetracing you can call the interface message.