Getting Widget To Actor

Hello,
I want to get reference of my Widget so i can bind EventDispatcher from the Widget. Only solution I got is Create----Widget and then Bind Event. The Problem is that i can only use it when I create it in Viewport, and if I use MotionControllerPawn it doesnt work. Any suggestions would probably help, thank you! :slight_smile:

Does the motion controller have the widget as a widget component attached to it?

1 Like

Ye, It uses ControllerInput (ScreenShoot4, spline get attached, and on click triggers Button), if thats what you meant




Not really. I am assuming that you create another widget and attempt to add it to the viewport because you’re not sure how the access the widget component that already exists on the Motion Controller Pawn, right? Could you show the component hierarchy of that Motion Controller Pawn?

1 Like

Yes, RN i moved some parts of the code in the WidgetGraph, but still i cant transfer that to the LevelManager :confused:

Could you please show / explain where the widget you’re trying to access is? Is it a widget component that belongs to the Motion Controller Pawn? Can we see the hierarchy?

The Problem is that i can only use it when I create it in Viewport, and if I use MotionControllerPawn it doesnt work.

Currently, it it unclear what you want to do. You say:

I want to get reference of my Widget

Where is that myWidget? How does it get created? By whom, when and where?

1 Like


Like I have the Panel, where the widget is built, then i have MainMenuWidget, where the code from above is. So there Im trying to get ButtonEvent, so I used Dispatchers, so even as i toggled Breakpoint on “CallLevel1Disp”, it gets there but never goes to the MainMenuWidget Actor bcs its not there created, so i dont call the right event.

Again, where / how does your Main Menu gets created then?

1 Like

Its just in WidgetClass in MainMenuWidget, and i just pulled it into the Scene.

Is this an actor? And it has a widget component inside? Judging by:

Its just in WidgetClass in MainMenuWidget

Yes it an Actor, and I used Create Widget, bcs i found no other solution to get any event from that widget buttons. And i could test it with viewport, so it worked, just cant use it as a VR Pawn. Watched few videos on yt but they were also like this made. :confused:

To clarify, because it’s really confusing:

  • you have an actor
  • that actor has a widget component
  • that component creates a widget
  • that actor sits in the scene

Correct?

Who is now trying to access that?

I try to acces it with the MainMenuWidget, and my VR Pawn, but i cant find anything like (GetActorOfClass, so i can get anything of that widget)

This makes no sense. You’re trying to access the widget with a widget?


Is the Pawn trying to access the widget?

Is this BP the Pawn? And it tries to get to the widget that sits in the world?

Im trying to acces that whats in WidgetGraph with my WidgetActor, bcs i need that whats in Graph(I mean like OnPressed(Button1)). BP in the Picture is MainMenuWidget Actor

Got it.

You can promote it (with right click on the pin) to make it easier but it’s optional if you’re using dispatchers.


So the Pawn has nothing to do with it?

1 Like

Ill try it, just the problem is that in MainMenuWidget i cant call any dispatcher, without CreateWidget.
I use pawn just to teleport, tried with GetPlayerPawn/Character doesnt work (idk why) and just made an event in Pawn so it targets “self” and then i call it in mainmenuwidget




That’s what I suggested does.

Ill try it, just the problem is that in MainMenuWidget i cant call any dispatcher, without CreateWidget.

It would be easier if you just showed the actor component hierarchy, like I asked 3 times… If the actor has a widget component, it should be there. If you’re using a widget component, it creates and maintains a widget automatically. There’s no need to Create Widget. It would be another instance of the widget - not the one that you want.

I use pawn just to teleport, tried with GetPlayerPawn/Character doesnt work (idk why) and just made an event in Pawn so it targets “self” and then i call it in mainmenuwidget

No clue what it has to do with anything to be honest.

1 Like

U mean like this?
I would probably show you if i knew what ur talking about, and how, sry :sweat_smile:

You wanted a widget reference, now you have it - use it to bind to dispatchers inside. Use the reference instead of creating an orphaned widget:

Assuming:

[…] acces that whats in WidgetGraph with my WidgetActor, bcs i need that whats in Graph(I mean like OnPressed(Button1)). BP in the Picture is MainMenuWidget Actor


It’s just this. You widget was here, originally, right?

1 Like