Download

Having problems with casting to widget

So i’m working on a main menu for our game and i can’t seem to find a way to cast to my widgets, here’s the pictures and the part is boxed that i need help with

If someone could help me i would be very thankful

You have to put in that pin the reference to your W_Menu class object. But I can’t see where you are creating it so I can’t help.

Tip: when you create the W_Menu save the ref of created widget in a variable, then find a way to get it in your W_StartMenu.

Would this help in any way?

Now is clear :smiley:

You need to pass the ref of your parent GUI (W_Menu) to the child one (StarMenu), my advice is to create a a W_Menu ref variable in the StarMenu called “Parent” and set it editable and expose as spawn. When you create StarMenu the creation node will require a W_Menu ref, put it in a reference to self. Then you can use the brand new “Parent” variable to cast.

EDIT: to be honest you don’t even need a cast, if you want to make your GUI a little more “”“universal”"" you can ask for a Widget ref instead of a W_Menu ref (as exposed variable). If you do this then you need a cast.

Thankyou so much, i probably would’ve never figured this out without your help :smiley:

Glad to be helpful! :slight_smile: