As you can see from the image below I’m doing the same thing in two ways, I’m taking a pointer to the pawn spawned by default from the GameMode and assigning it to a variable, first in Blueprint, then in C++ & Blueprint together.
The Blueprint version is too long and not suited for the level of abstraction provided by blueprint (imo), but it has the advantadge of easily allowing me to say that the Player variable is of type Player_BP, therefore I get the proper interface for it.
The C++ version hides away some stuff that shouldn’t clutter the Blueprint graph to begin with (imo), but now the Player variable is hardcoded to be APawn* , therefore I need to cast it everytime to Player_BP if I want the right interface inside blueprint.
But, the GameMode hold a variable called DefaultPawnClass so it knows that my pawn class on this game mode is Player_BP, therefore how would I make it in such a way that the Player variable in the C++ code is of
type * based on the blueprint type I’ve passed in the editor for the DefaultPawnClass field?
Basically I need it to be something like [FONT=courier new]decltype(TSubclassOf<Player_BP>)*[FONT=courier new] [FONT=courier new]Player;[FONT=courier new] but it should also dynamically change type if I give it another blueprint from the editor.
So how is that done?