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:
-
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.”
-
Go to the Event Graph on the on the UMG widget and create a function - call it fnSetDescription.
-
fnSetDescription will receive 1 input of type ‘Text.’ Call this input NewText.
-
Inside fnSetDescription drag ObjectDescription from the left onto the graph and from the pin drag out and type “Set Text.”
-
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.
-
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).
-
Drag from Begin Play node and create a new UMG widget of class ''WBP_Interaction" and set its reference to a variable called “WBPInteractionRef.”
-
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”
-
Now you will see that fnSetDescription has a text input variable called “NewText.” Now drag your ObjectText variable and connect it to this function.
-
Drag from WBPInteractionRef and type “Add to viewport” to display the widget on the screen.
-
OnEndOverlap event from your trigger grab WBPInteractionRef, drag the pin and type “Remove from parent.” This will remove the widget from the screen.
-
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!