Widget Component reconstructs when parent actor rotates and all bindings are lost

There’s an actor with a Widget Component inside. On the actor’s Event BeginPlay event a function is bound to an event dispatcher from the widget assigned to the WidgetComponent. The event dispatcher in the widget is called on construct (for testing) but there’s also an event dispatcher indicating which button was pressed in the widget.

Everything works as expected when playback happens. The construct function is called as expected and button presses relay which button id was pressed. That is until the actor changes location.

If the actor’s location is changed, the widget refreshes. The Event Construct is called again in the widget, but the function it was bound to in the actor is not called. It’s like a new instance of the widget was created when the actor changed it’s location and all bindings and references to the previous widget instance were lost.

I’ve tried using the OnComponentWake and OnComponentActivated events to get notified that the widget has been recreated to rebind things.

The question is what is the best way to establish a connection/bindings between a widget assigned to the widget component and the actor if the actor moves and rotates?

I could just push everything in on tick and for somethings that would work fine. But what about bindings to events? How do I make sure they are not lost when the actor moves? It seems weird to bind events on tick.

Never mind, it only reconstructs when you manually change values in the editor, it works fine when the actor is animated using a level sequence or through runtime forces.

Hi there @kantz, hope you’re well.

This topic has been moved from International to Programming & Scripting: Blueprint.

When posting, please review the categories to ensure your topic is posted in the most relevant space.

Thanks and happy developing! :slight_smile: