Firewatch style context sensitive interaction

I’d like to create an interaction system like the image posted below.

In firewatch, the interaction system seems to be context sensitive. I can replicate this to a degree.

So far, I’ve created an interface which I can use to trigger certain events such as opening lights, turning on lights etc.

I’ve also been able to create a HUD which toggles the input action prompt through the widget.

I followed one tutorial that shows creating a text widget which can then have the objects name from an interface function. However this didn’t work for me.

What would be the best way to essentially implement two widgets which change based on the object name and then whether the object is a pick up or door. So it would change to say pick up or open for example.

Thank you!

That would be my starting point:

  1. Create a widget with an Image and Text. Create two variables: Texture2D and Text. Expose them on spawn so that you can assign them when constructing a widget. In Construct (or PreConstruct to have an editor preview), assign the variables to the Image and Text.
  2. Create a new Enum named EInteractionType.
  3. Open the enum and add a couple of types, like “Doors,” “Pickup,” “Talk,” etc.—whatever you need.
    (I also like to add “None” as the first element to handle some unexpected behaviors.)
  4. Create a new Interaction Interface, then create a function inside, like GetInteractionType, with the EInteractionType enum you created as an output.
  5. Now, in a blueprint you want to interact with, add your Interaction Interface.
    Implement the GetInteractionType function and set the type you want for this blueprint.
  6. The last thing is to call this function. It’s up to you how to handle it. One way would be to cast a ray from the player’s camera and check if it hits an actor with the Interaction Interface (using the DoesImplementInterface node). If so, then call GetInteractionType and create the Interaction widget, populating its exposed variables with the Texture and Text you want for the given type.

Of course, there are hundreds of possible approaches—this is just one of them.

A couple of notes:

  • If you have “None” as the first enum element, you can use it as the default output of GetInteractionType. That way, when you add the interface but forget to implement it, you’ll trigger the “None” type, which will be cleaner to debug.
  • You can add a TriggerInteract (or something similar) function to the interface to actually trigger interaction in the target blueprint when the input is triggered.
  • In the future, when you feel confident, instead of using the enum, you can create a Data Table, which would store not only the type name but also the Texture and Text at the same time.

Let me know if it’s clear and how it goes.