Why wont my UMG Widget BP recognize public variables made in other blueprints?????

I’m communicating between my player controller and another blueprint just fine. At first it wasnt, and then I spawned the Blueprint I was trying to communicate with, within the playercontroller first, and then the controller was able to talk to that blueprint.

Link 1.png

Link 4.png

Link 2.png

Link 3.png

Now I want to take a variable I SET in an Actor blueprint, and allow my UMG Widget blueprint to access said SET variables within the Actor blueprint.

But every time I try to call on those public Variables from the Actor Blueprint, in my UMG Widget Blueprint, Nothing Happens.

I realize Widget Blueprints are different, in that they are created in game, and become communicatable with, after they are added to the viewport and set it as a variable.

Well, in my player controller, I see the viewport getting created, but there is no place to set a variable for it?

Much confused, such convolution, Halp pls.


this is pretty much because you have no idea what References are. The Blue Reference Variables you create are just containers. If you only create them and never fill them, you can’t call something on them.
Your code should spam you with “Accessed None” errors.

The reason why the code works as soon as you spawn the Actor is that you saved the return value in that “container”. Without doing that, it’s empty.

If you have a Reference Variable in your Widget and you want to get variables from it, or call functions on it, you need to make sure that it’s not empty.
The Node “IsValid” makes sure that you don’t use empty nodes. That is really important. Accessed None Errors will crash your game if you package it later, plus nothing will work if you don’t fill these variables correctly.

For example: Your MainHUD has a Variable called “PrimeStructuresMasterBPRef”. That is probably empty. You have it set to Editable and Exposed on Spawn, which is basically listing it in a “CreateWidget” node you would use to spawn the Widget.
Check back on the CreateWidget node you use to spawn MainHUD. You’ll see all these variables that you marked with Edtiable and Exposed on Spawn.

I assume your MainHUD and the PrimeStructures thing are both in the PlayerController? Then there are 2 cases that can happen:

  1. You have your MainHUD Widget already spawned and then spawn the PrimeStructures thing.
  • Then you would take your MainHUD Reference variable (which you would set when you Create the Widget) and call “Set PrimeStructures…” on it. Obviously pass the newly spawned Actor into the SET node.
  1. You have your PrimeStructures thing already spawned and saved into a variable and you are now spawning your HUD.
  • Then you could do the same thing as with 1, or you use the Input on the CreateWidget node that got created from exposing the variable on spawn and set the Reference directly here.

If however this is all way too complicated for you, then PLEASE watch this stream from EpicGames:
It explains very well how referencing works.

Hey there,

Thank you very much for the response, it answered my question thoroughly, I understand now thanks to you.

Can I just ask though, what is the point of setting a variables Variable type if it doesn’t “Fill” that variable reference with that specific class?
Maybe I should go watch that video before pestering you more though ><

I thought I was filling these variables this whole time.

You should read some basic programming tutorials about variables and references

Think of the variables in the left side of the blueprint as an adress (which, in the end, they are).
If you just create them in the blueprint, they don’t have something to adress at all.
How do you get to an actual object? You redirect this adress to a real object. This is done with the set-node

You can call functions and getVariables of a “non-filled” reference, because the editor is “assuming” the reference is pointing to a real object.

Thank you thank you.

Ok I really got it now.