Hi, the first blueprint is a NPC and as you can see, i’m trying to set a variable “dialogue row name” after adding a widget (a dialogue box) to the screen. The variable “dialogue raw name” is stored in the widget blueprint.
When the dialogue widget is created, the variable should be set to “Bob” in my exemple and the print string should print “Bob” while the dialogue box is shown but it print the default value “None”.
Everything else is correct, the dialogue box is created so the “Cast to Dialogue” is not failed. After reading thousand topics about casting to widget, is still don’t know why the variable is set in my blueprint but not in my widget.
Thanks for your help.
So, first of all, you do not need the cast in the first picture, since from the “Create Dialogue Widget” you already get the correct class (this is what that “Note” says on the cast).
And the reason that it doesnt work is simply that the Event “Construct” is already called automatically on the “Create Dialogue Widget” (and at that moment of course the Dialogue Row Name variable is “None”), and you are setting your variable afterwards, so it doesnt have any effect.
The easy fix would be, make a Custom Event and connect that to your logic instead of the “Construct”, and then in your NPC just call this custom event after assigning/setting the variable.
Cheers,
Thanks but in fact I just forgot to connect the “owning player” pin of the “create widget” node. Now everything works

