Hi,
OnNewPawn.Broadcast(NewPawn) is not working.
void UTrpgControllerComponent::OnRegister()
{
Super::OnRegister();
if (AController* Controller = Cast<AController>(GetOwner()))
{
Controller->GetOnNewPawnNotifier().AddUObject(this, &UTrpgControllerComponent::OnNewPawn);
if (APawn* Pawn = Controller->GetPawn())//Just in case controller already has a Pawn I think this would never happen, just in case
{
OnNewPawn(Pawn);
}
}
}
But if I debug the game, OnNewPawn.Broadcast(GetPawn()); it’s called inside PlayerController and Controller, both in OnPossess methods, but for some reason they aren’t triggered.
I saw that it wasn’t working until 4.22 but I am using 4.25 and it doesn’t work. I am doing the same thing as
UPathFollowingComponent and my component is owned by a Controller.
Controller->GetOnNewPawnNotifier() returns a valid object, but it doesn’t get triggered.
Please help!