Is Valid and Cast To nodes problem with Widget Blueprints.

Hi and hello :slight_smile:

First of all if there is a huge difference in using one big Widget BP with lots of hidden and visible widgets instead of few smaller Widget BPs?
Few of the widgets can be quite consuming since they are “streaming” the view from cameras.
But that’s not why I’m here.

And here is the proper question (questions).
Basically I have no idea how to use “Cast to” node properly. Very often i’m experiencing error and warnings. Here is what I want to accomplish this time and I think “cast to” can be very handy here… but i need Your help.

I have two Widget Blueprints. First one is called “Desktop”, the other one is called “Window”.

Here is “Desktop”.
It creates a fake loading bar (bar is destroyed after filling up to 100%) and the “Window” Widget BP in this specific order after the doubleclicking icon.

Here is “Window”. It contains few widgets like buttons, images etc.

And here is the thing :

The "Desktop" was able to allow us to create the “Window” Widget BP as many times as You wanted by simply clicking on the icon on and on.
So to prevent that i created “Is Valid” node. In my opinion it should work fine. You should be able to create “Window” Widget BP only one at the time. But the problem appeared. It looks like, once You create a widget, it stays in memory forever untill You relaunch the game. So the “Is Valid” was working untill someone wanted to close **“Window”**and open it again.

So I figured out I should use Branch and the Bool Variable.

And here is the another problem I can’t solve, but this time due to my lack of knowledge and experience.
What I know is I should somehow pass the information about “Is_Open” Variable from the “Window” to “Desktop” to let it know that the “Window” can be opened again.
But I have no idea how to do this properly :frowning:

At the bottom of this blueprint You can see references to both Widget Blueprints.

And here are the things I need Your help with.

If I wanna keep the “Is Valid” node, i need to know how to remove the “Window” from the memory after removing all of its components. As far as I know there is no way to remove Widget from the memory once it was opened. Maybe I’m wrong.

If I’m not, I need You to help me pass this Bool information from the “Window” to “Desktop” so it can be opened again.

Thank You for Your time in advance !

You could Destroy the Widget after you have removed it.

But, I think the better way if your having problems like this is to use the UMG Switcher. Unfortunately there doesn’t seem to be any documentation available on the UMG Switcher. There are several AnswerHub questions regarding how to use it. The switcher is made to handle switching between different UMG Widgets.