How to make Simple Interaction?

How to use the HUD to make appear a text like “Press E to interact” when character is close to an object?

  • Thanks in advance :smiley:

One possible way to do it would be as follows:

Make a new actor class and call it “Interactable” or whatever you think is appropriate and add a sphere collision component to it. Use On Component Begin Overlap and On Component End Overlap, respectively, to drive the HUD events within your character. Create a custom collision channel that only reacts to pawns and assign this collision channel to your sphere collision component.

Set up your character to use an interface and create interface functions to show and hide your UMG widget with the interact text. Call these functions from your interactable class on the overlap events. Any object in the game that you want to trigger this interact menu should inherit from your interactable actor class.