Hey, so I have a game in which I have a dialogue phase (in a widget blueprint) and then I want the game to start. So when the game starts, I want to put new widgets on the screen. But to do that I need to know when my dialogue ends.
This is the problem. I need to cast to my widget dialogue in my level blue print, but I can’t find what to put in the cast object.
Thank for your help
Hi @TomatoLauncher8
I don’t know how you’re accessing the Widget or what have you tried, but it should be a simple Cast to if you have the widget object.
Alternatively (but I’d try to avoid) you can Get All Widgets of Class assuming you only have one.
Thank you!
The problem I have is that I don’t know what to put as object
When you create a Widget you have to store the Output in a variable, and that’s what you use. If you store the variable with the same type as your widget, you don’t need to cast to use its events, variables, etc…
As you can see in the image, the type of the Return Value is not Widget, but the same as the Class I selected.
Hi there @TomatoLauncher8, hope you’re going well!
This topic has been moved from International to Programming & Scripting: Blueprint.
When posting, please review the categories to ensure your topic is posted in the most relevant space.
Thanks and happy developing!
In order to cast to your widget dialogue in your level blueprint, you need to have a reference to the instance of the widget dialogue that is currently being displayed.
One way to achieve this is to create a variable in your level blueprint that will hold a reference to the widget dialogue. To set this variable, you can use the “Create Widget” node in your dialogue phase, which creates a new instance of your widget dialogue, and then assign it to the variable.
Once you have a reference to your widget dialogue, you can use it to call functions or retrieve values from the widget. To end the dialogue phase and start the game, you can add a function to your widget dialogue that sets a variable or calls a function in your level blueprint to signal that the dialogue has ended.
Then, in your level blueprint, you can use the “Cast To” node with the reference variable you created earlier as the object input. If the cast is successful, you can then call functions or retrieve values from the widget dialogue instance.