Player pawn gets destroyed and cant respawn

i build of a shooter from the firstperson blueprint template. when the player dies i do destroyactor self.
i bind an action to ondestroyed and restartplayer from gamemode in that. this does not work.
my workaround is to save the playercontroller before destroying and feed that into restartplayer.

i dont like this solution and am wondering how a simular effect could be achieved with a different aproach.

Hello! You can do that in several steps

  • Get Player Controller
  • Unpossess from current Pawn
  • Destroy Pawn
  • Spawn new Pawn where you want
  • Possess it from your Controller

i thought maybe there is a way to not having to cache the controller variable

one problem i now have in another place is, that when the character gets destroyed i did not find a way to get its controller…

You can always use GetPlayerController (both in BP and CPP - Get Player Controller | Unreal Engine Documentation and UGameplayStatics::GetPlayerController | Unreal Engine Documentation)

as far as i know that does not work in multiplayer.
edit:
i found a workaround:
i catch the fire event in my playercontroller and when no pawn is attached i respawn the player…