Download

Help casting to widget.

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

Casting.PNG

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

8ea2a84ab2769aa56512d2d7fd087946200dfef1.jpeg

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.