Download

How to override AGameModeBase::FindPlayerStart() in C++

I’ve started with the TwinStick Shooter template project, using C++.

I’ve written my own Pawn subclass in C++, and I can get the GameMode to instantiate my pawn instead of the TwinStick pawn.

However, when it starts the game, it doesn’t look for a PlayerStart, but instead starts me at (approximately ?) the origin.

I can solve this in two ways:

  1. Figure out why it’s not spawning me at the PlayerStart that exists in my level.
  2. Make the GameMode FindPlayerStart() function return where I want the player to start.

But, the FindPlayerStart() function is not virtual. It is, however, a BlueprintNativeEvent.
I’ve looked at the documentation, but not found the right place to figure out how to bind? override? a BlueprintNativeEvent from C++.

Actually, the problem seems to be that, while the playerstart is found, it’s not used by my pawn.
What am I forgetting, to make this work? It looks pretty similar to the TopDown pawn, except it overrides BeginPlay() and calls Super::BeginPlay().
It also creates a box collider as the root component.

Seems to be that the box collider intersects with the terrain and I hadn’t turned off “spawn anyway.”

That being said: I still want to know how to provide the FindPlayerStart() behavior in C++, rather than Blueprint!

For BlueprintNativeEvents, Like so:



virtual void FindPlayerStart_Implementation() override;


If/When you call Super, be sure to call Super::FindPlayerStart_Implementation() too.

Exciting! Thanks for the answer!