Currently I am trying to implement text appearing when the player interacts with an object. It functions in terms of the widget appearing with the correct text. BUT I cannot seem to find a way to make sure that if the player interacts with many objects the corrosponding widgets dont overlap.
The script of your Player Controller should work fine as it is. The second image is really hard to read, could you share it again with more zoom?
Having said that, I think you are also adding a widget to viewport from the BP_Statue in addition to the one you are adding with the Player Controller. Is that intended?
As you can see there, the first thing you do is to check if the variable “Spawned Widget” is valid, then, if it is, you remove it and spawn the new widget. If it is not valid, you directly spawn the new widget and store it into the player’s variable “Spawned Widget”.
That’s it! Whenever you open a new widget, you will first close the previous one, avoiding any overlap.
Remember, do not spawn the same kind widgets in any other place or this will not work. Or at least remember to store them inside that player’s variable and remove them before adding another widget.
Thank you so much @BRGJuanCruzMK I definitely understand the concept here although I do have some questions. I was able to implement this partially, below is my version. Currently when interacting with multiple objects the first object displays correctly then every subsequent widget is blank.
I do have some questions about the version you shared.
-In the interact function that you shared what data type is the variable “Interactor”? and why does it have to be cast to the player?
-Where would you suggest calling the interact function? I assume it would be in the player’s BP when they interact with the object.
-When if what your showing is added to my code should replace it with a portion of the code from my player BP? I think they are trying to accomplish the same thing.