Interact Message Appears over everything.

So I have a text variable in every Actor necessary. the Text Variable is “Name” I have setup a widget with a Text variable that uses the Text Variable from the Actor and sets the name of that variable and applies it as the text in the widget display.

Expected result: The Widget should pop up showing the Name variable.
Therefore whatever name I give to the Actor’s Name Variable, the Widget will set that as the text to display in the widget.

Reality: The widget appears over every item that is not the same actor or class of Actor.

Will post as many photos as I can for this.

If you can see, this is the function I set for the interaction widget to get the name variable from the Actor the playercharacter overlaps with.

Two things I noticed here:

  1. The same name appears over everything because the first integer value / element in the array index is the first actor the function picks up. The result is that now every other object a name other than Nathan will have the name Nathan, Think of it as a Baby learning it’s first words. it learned the word Apple for the first time, and now it goes around calling everything else Apple LOL.

  2. One other weird thing I noticed is that I have a Dialogue box that shows the name of the speaker; and when I approach the NPC, their name appears in the Dialogue box as expected! What makes this weird is that there’s no fancy Blueprints being added to the Widget OR the NPC actor. just reference the NPC actor in Widget get the name variable, and set text of the Dialogue box to the NPC Name, and it works; but for the interaction widget, no good.
    Here’s that example Below:

There’s a lot of strangeness in this setup:

And the above is the worst offender.

When you interact with this:

  • you fetch all NPCs rather than just this one
  • then only do things with the first in the array (which does not even guarantee any order whatsoever)
  • then the function goes out of scope so you apply it only one

Why not just bind text to a text box and show / hide widget?


  • could you tell when the interaction is supposed to happen?
  • when the player approaches the NPC, the widgets shows up?
  • and when the player moves away, the widget disappears?
  • are you using widget components for this?
  • and what is the setup - each actor has its own widget, right?

Could you clarify the above?

Hello!
could you tell when the interaction is supposed to happen?

Whenever the player nears it / overlaps it’s collision field ie, “when the player approaches the NPC” as you said.

and when the player moves away, the widget disappears

Yep :slight_smile:

are you using widget components for this?

Yes.

and what is the setup - each actor has its own widget, right?

Each Actor has their own Widget Component.

Hopefully I can post more screenshots in the Comment section.
w
I didn’t wanna do binding text because I heard it’s not good for performance. Yet I see so many people try this so I avoid it. I’m stuck because I don’t wanna move forward with this until I am certain of this.

Here’s how I’d do it:


This is my NPC:

  • above: the widget component is set to screen mode and is hidden by default
  • below: when the game starts we feed the widget the name of the NPC; this variable is Instance Editable

  • the sphere overlap detects the player and shows / hides the widget component

In the scene:

The widget:

332631-widget.jpg

  • the text block is flagged as isVariable

Image from Gyazo

Project link attached:


I didn’t wanna do binding text because
I heard it’s not good for performance.
Yet I see so many people try this so I
avoid it. I’m stuck because I don’t
wanna move forward with this until I
am certain of this.

This depends on what you bind and how you do it… If you worry about performance, you should definitely avoid GetAllActors types of nodes. Just read the tooltip it comes with :slight_smile:

Thank you! For Two days I have struggled with this issue, and it was something as simple as toggling the visible box LOL