Help casting to widget.

I’m trying to cast to another widget to get access to variables (buttons).


Not sure why it won’t work. Anyone have any ideas?

What’s not working, specifically? Also, keep in mind that the construct event can fire before everything else has had a chance to initialize.

It says it accesses none trying to read property S1Ref

You can also use the following. Make a cast to your GameInstance set YourGameInstanceName, then:

Get YourGameInstanceName > Get Starter1 > Set S1Ref

Does this work?

I’m not sure what to do, could you please provide screenshots (I’m new to UE4)?

Make a new GameInstance, add the GameInstance to your project settings (Maps and Modes), then on the GameInstance create a function, then call the Widget directly


Above image shows CreateCharacter screen variable access from my GameInstance, the name of the User Widget is CreateCharacterScreen. This is a way to access your widget variable.

I’m still confused. I understand everything that you are saying up until the screenshot.

The variable you try to set in above screenshot S1Ref, you can set it from the GameInstance when you call your Widget name.