How i update a variable inside my widget blueprint from my blueprint actor and make it to work even if blueprint actor have more than one copy (instance) in the game?

How i update a variable inside my widget blueprint from my blueprint actor and make it to work even if blueprint actor have more than one copy (instance) in the game?

Soo…i have this blueprint actor called “door”. this blueprint call my widget blueprint and add it to viewport. In my “door” BP, i have the variable “name override” (string , editable) to override my blueprint name, because i need to get my “door” BP, put in the level, and get a lot more of same “door” BP and put too in my level. But, each of one Must have a unique name. And each of one “door” BP, Must need to set the value of the “name override” variable to my Widget Blueprint (called Door Widget") variable, called “name” , also a String variable, also editable.

So far, so good. Now the problem is: WITHOUT the widget, (without create widget in my “Door” BP) this work very well (only changes the “name override” in blueprint details). WITH te widget, i can´t override my “name” variable in my widget “door widget”.

I´m already create the reference to my “door widget” in my “door” BP, and a reference to my “door” BP in my “Door Widget”.

I created a simple text block in my designer on door widget, and created too a bind to my “name” string variable.

See below what i have so far. I just cannot figure out what is wrong…

![Door Widget Graph][2]

![Door BP Construct][2]

Any ideas?

I forget to add the “construction script” from my “Door” BP. Here is:

So, i make a mistake with the "event construction " on my Door Widget, but i´m already fixed this. But the “issue” remains. See below the fix on event construc and a Video to demonstrate the BIG problem…lol

[YOUTUBE TEST VIDEO - BLUEPRINT INSTANCE][2]

Still get stuck on this :frowning:

Well your get.array(0) is going to only find the first door.

You want something to different the doors such as children bp classes with a struct with a string called “doorname” as a public variable then all child bp classes just set the doorname variable in class defaults to something like door0001 door0002 and you work off that.

A for each loop is going to be your best friend most likely.

Let me know if this helps
Don’t forget to accept an answer that best clears your question up or answers it so when the community finds your question in the future via search/google they know exactly what you did to fix it/get it going.

You have to work with arrays to store names for your different actors in your level. Something like this :

Ok, but in my case, i´m working with only one actor blueprint, and i´m need to do several copys of the same blueprint and set the name of each one in the blueprint details, and set the text of each one widget BP called from my actor BP on game viewport. All this in the same blueprint, as i said, in game viewport. In that way is possible?

In that case i need to do some research in BP children because i don´t still have the knowledge to undestand how it work, so far. Any chance to post a screenshot to give me an idea on how this work ?

Yes. You can do that. You can add another public variable of type int in your actor blueprint. This variable will define the index of your actor blueprint in your level like 0,1,2,3 and so on.

Now in your widget’s tick event find the value of this variable (e.g by trigger event on your actor). Now you can use this variable to get the same index in “door Text” string array that we have created on widget’s Event COnstruct,like in my previous comment.

Hope this helps

Thanks
AB

Well…i understand your point. But, i still stuck because i don´t figure out how to increment the index …for hours i try in many diffefrent ways, and nothing. See below:

If you just want the text to be displayed on trigger event of every door, then you can do it without using arrays too.

  1. Create a public variable for name of your door whose value you will set in level editor (Like you are doing now).

2)Create a string variable in your DoorWidget too.

  1. Set a trigger box for this Door BP on whose overlap you will set the value of DoorWidget variable using the widget reference(widget reference created while adding widget to viewport)

  1. Add a TEXT component in your widget, and create binding to it. Return the widget variables value in it.

It will print name on widget , everytime player goes into triggerbox of a Door BP

-AB

yeah…i´m already do that…not working, at all…the door widget still keep showing only the first “text block” . If a drag 2 or more copys of Door BP in the level, all this BP show only the first change on text block.

Like i show in my video, not matters what i write in each one Door BP in the level…all this door BP keep showing only the first change on variable.

I can make this working on my side as I have shown in above snapshots.
Make sure you are updating the DoorText in overlap event. You were doing Set Text in Event Construct of your widget which is called only once and setting the value one time. So you need to create a binding for your text in widget , not in event construct.

How you cast widget reference from game mode? On my side did not cast from game mode and “as third person game mode” to Widget Ref…

I have created widget reference in my GameMode’s beginplay. So I am getting reference to widget.

You need to get reference from where you have added the widget to viewport.

Ok, tks for the help.

I realized that I will need to use the index to make use of this on other issues.

To this end, I will open another post

Hi I’m trying to replicate this and also having issues. In my Door BP (which has trigger box) I have built the ‘eventbeginplay->create widget->set->add to view’ as you showed above. But in the same blueprint I’m trying to recreate the ‘onEventOverlap’ chain that you showed above… with no luck. In that picture, I don’t know how to create anything to the right of ‘castTo3rdPerson’ (except for the name variable, I have that).

Been pulling my hair out on this for days. Thanks for your help!

[I need to create a blueprint or widget with the help of that I would be able to remove materials of selected static mesh from its editor but not not from details panels. can anyone create this]

please help if its possible