Better way to add text to a inspect system

Hello all,

I have a inspect system, where I click, the object go close to the player view, and I can rotate this object, and when leave the inspect mode, this object back to his original location in the world… I have a raycast, and when he hit a object he cast to another BP, who have a static mesh only… then I can rotate this object … I have another system but instanced of use Cast to Blueprint he use Actor has a Tag node…

Now Im trying to add some kind of text support, like the image below, in the image, when you click “spacebar” the UI are replaced with text, to be better to read (image from the game Layers of Fear).

What is the best way to add this kind of text support, if you have example more then one “inspectable” object in the scene?

I made the same question in the Answers Hub, and Civility_Reigns told me to do:
"You can create an editable text variable in your inspectable object blueprint where the text can be stored. Any instance of the object you place in the level will then have its own text property, which can be found in the details panel and changed just like the location or rotation. This variable will also be inherited by any child blueprints, so if you create specialized inspectable objects (bloody notes, bullet casings, and so on) they will have their own inspection text variables, as long as you set the original inspectable object blueprint as the parent.

This variable can then be accessed in any of your blueprint scripts that work with the inspectable object. For example, a UI widget could get the value of the inspection text variable from the inspected object, and set the content of a text widget using the value that is returned."

But I dont undestand how I can store text value in the “Editable Text variable”


Hi @Rgiz,

I’m not at home so I dont have access to UE4, but I will try to explain in words one way of doing this:

You have two elements that you need to set up: InspectionObject (like your cube) and a UMG widget blueprint WBP_Interaction.

Here are the simple steps:

  1. Create a widget blueprint that will display the text for all inspected objects. In that blueprint drag a text box into the screen and select “Is variable” on the right panel. Name the textbox something useful like “ObjectDescription.”

  2. Go to the Event Graph on the on the UMG widget and create a function - call it fnSetDescription.

  3. fnSetDescription will receive 1 input of type ‘Text.’ Call this input NewText.

  4. Inside fnSetDescription drag ObjectDescription from the left onto the graph and from the pin drag out and type “Set Text.”

  5. From the initial block of fnSetDescription you will see your text input (NewText). Connect that input into the Set Text node. Essentially any text that is passed to fnSetDescription will then be the new text of ObjectDescription.

  6. Now go to your InteractionBP and create a new variable of type TEXT and name it “ObjectText.” Make this variable public (click on the green icon).

  7. Drag from Begin Play node and create a new UMG widget of class ''WBP_Interaction" and set its reference to a variable called “WBPInteractionRef.”

  8. Inside InteractionBP create a OnBeginOverlap event from the trigger you set up. When this event triggers grab WBPInteractionRef and dragging from its pin type “fnSetDescription”

  9. Now you will see that fnSetDescription has a text input variable called “NewText.” Now drag your ObjectText variable and connect it to this function.

  10. Drag from WBPInteractionRef and type “Add to viewport” to display the widget on the screen.

  11. OnEndOverlap event from your trigger grab WBPInteractionRef, drag the pin and type “Remove from parent.” This will remove the widget from the screen.

  12. Now all you need to do is type each object’s description into the ObjectText public variable for each object in the world (select the object in your level and look for variable ObjectText).

Reading through this again, I make it sound really complicated but its really simple. Alternatively, if you are still not sure how to do it, feel free to download my free template (look at my signature). There I have this exact example on my Power Ups Blueprint (the ones that gives you new abilities).

Hope this helps!

@CoquiGames thanks to stop by, I really appreciate, thanks :slight_smile: I try for 3 days, ask in FB groups, AnswerHub and here, I almost back to Unity lol… Just now I saw your answer, and yesterday I make this works, look how I made, I dunno if this is the correct/better way, but works ^^

I use the “bind” in the Text Block inside the Widget BP also inside the Widget, I create a text variable WidgetObjectText, and checked the WidgetObjectText is variable.

In the BP_MasterInspectObject I just add a Static Mesh component and create a text variable “InspectObjectText”, with that I just create a child bp from the master, change the mesh/object drag to the viewport and in the details panel I just add the text I want to this object…

In the FisrtPersonCharacter BP I create the widget and add to viewport after hit the object with the BP_MasterInspectObject, get and set the text variable…and when I leave the Inspectable Mode, I set the text variable to blank

Now reading this, you think its okay to use the “create widget node” each time I inspect some object? :confused:





Btw, nice adventure system u have…I love the portal <3
Thanks again

Hi @Rgiz,

Good to hear you got it working! Tbh, Im also a newbie (been learning UE4 for 5 months), so your way may be more efficient since you dont create a new instance of the widget every time.

I also came from Unity and at first found UE4 hard to learn. But all I can say is don’t give up! After your understand how all the systems works its an amazing engine and super fun to work with :).

Feel free to message me if you have any questions and I’ll try to help as much as I can.

Btw, my template is basically what I was able to learn in 5 months with my first game :).

Same to u coquiGames, if have any question just drop a message to me :smiley:

Hi guys,

Thanks for putting up this question as I was trying to see if I could do something similar. I am a beginner with BP scripting so there might be a better way to set this up.

The purpose for the actor is to have instances of it placed in the world with public text variable in exposed in editor that will take the input and assign it to it’s “self” instanced actor’s 2D widget with text.

My problem is that I can’t get the public text variables to be set to each instanced actors which are spawned at BeginPlay. Each actor contains a widget component to display a 2D widget in 3D space. The actors move up and down with a speed that can be set to each instanced actor from the public int varbiable. So that one works.

If this workflow I setup (from the screenshot) would be a good start, I wounder if the focus need to be on how to create “instanced” text widgets that holds the text, as many as there are instanced actors placed in the world?
Because from what I assume is that the binding function only has one static text in the widget to look for (see step 3 in screenshot).


I tried the solution below. Maybe not the best one but it seem to work. If anyone has a more effective workflow and willing to share am happy to see comments.

The idea was to first spawn actor in world and then dynamically add widget component to each spawned actor. Then create and set 2D widget to each widget component, and also set it’s properties.

The created 2D widget will have two text var (exposed on spawn), which will have the public text var plugged in to.