Empty Widget variable's class is None

I added a MainMenuWB widget variable to the PlayerController. If I try to read it’s class when it is still empty is gives back None, instead of MainMenu. Is it because it wasn’t allocated yet so it doesn’t have a class? Or is it a bug? For me it would be logical to work even when empty, since the class of that variable is already given.

TL;DR:

I would like to use it like this:

But it only works like this:

Bug or normal?

So, is it intentional?

Hi CrimsonHawk,

If you don’t set a default value it will return as “none”. What you will have to do is change the variable type to class rather than a reference. You can see this when the color changes from blue to purple. Here is a screenshot of where you do this in the BP editor.

Once you have change the variable type to class you can set your default value to be “MainMenuWB”. That will allow the variable to return your Widget class instead of “None”.

Let me know if that helps,

Ed

for the reply. This way I’d have to make a new variable, that wouldn’t be used anywhere else. What I wanted to achieve was to make a widget that is the same class as the variable reference’s class. Because I store the widget there, and if I’d like to change it, then the create widget node would change with it “dynamically”.