My project crashed on mobile in void USMStateMachineComponent::PostInitialize()
when GameInstance->GetOnPawnControllerChanged().AddUniqueDynamic(this, &USMStateMachineComponent::OnContextPawnControllerChanged);
and I wondered it is because we capture this
in SetTimerForNextTick in a lambda. Did anyone occured the same issue as this?
Hi, looks like a bug here. I was able to reproduce when a component is destroyed the same tick it is initialized: Trello
I’ll add a TWeakObjectPtr capture to this
and check that it’s valid before binding the controller change.
A workaround without a code change may be to disable bHandleControllerChange
, but that’s dependent on whether you need the component to handle pawn possession. You could also delay the destruction of the actor/component by a tick.
I’m also casually looking for a FSM solution mainly to drive a branching menu system, and neither two built-in options are generalized enough. Did you find a workaround to your design issue here?