How do I get a reference to the specific user widget that's being displayed in a Widget Switcher?

Hi, there.

I’m trying to get get a reference to the specific user widget that’s being displayed in a Widget Switcher in my Options menu. But the issue is, the Get Widget At Index node gives you an object reference of a User Widget, not of the specific User Widget class you’re using. This gives me this issue when I try to get an object reference of the instance of the Widget Class I’m using to cast to a GameMode which will distribute that reference to all other User Widgets that run in the Main Menu level.

ChatGPT’s telling me that just casting the reference to the User Widget Class that’s actually supposed to be the type of your object reference, then sending that reference to the GameMode - will change that reference to the type you need, which sounds like black magic to me. Also, to do that cast, you’d need a reference of that User Widget Class to use as the Object input on the ‘Cast To’ node, which is impossible, because I don’t have it in the first place.

So, what should I do?
Any fixes are appreciated.
Thank you!

P.S. I will be out of the country by tomorrow, so if you have time to answer, please don’t wait.

Turns out ChatGPT was right.

What I got wrong was that I didn’t need to have a reference to the desired User Widget as the Object node for that Cast to the User Widget Class. Turns out what ChatGPT meant was to plug in the Widget Object Reference into the Object of the Cast To node, which would actually convert the object reference to the type that I needed. All I needed to do then was create a local variable in the User Widget I was working in, and set it to the output of the As UI Game Options Cat List node on the Cast To node, like this:

I’ll leave the post up so others can take example.
Your welcome!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.