Set default pawn in gamemode

The 2nd option is theoretically better as it point to class identificator (UClass) immediately while other option searches for UClass thru reflection and asset system based on string information which takes longer.

BUT, 1st option is only option for blueprint classes, as blueprints classes don’t exist on compile time as blueprints runs on virtual machine on run time so they can not directly point out same as C++ class, you are forced to go thru this searching process.

In general if you can avoid directly referencing blueprints in C++ if possible, so your code won’t be dependent on asset path , if you have game mode blueprint you should set default pawn in that blueprint, this gonna be passed down to C++ via base class of AGameMode that blueprint is using.

i noticed that the projects that come with unreal use this piece of code to set the default pawn

static ConstructorHelpers::FClassFinder<APawn> PlayerPawnBPClass(TEXT("/Game/folder/name"));
	if (PlayerPawnBPClass.Class != NULL)
	{
		DefaultPawnClass = PlayerPawnBPClass.Class;
	}

but i found that others use this instead

DefaultPawnClass = AMyChar::StaticClass();

is any of these options better than the other?