Didn't understand why we need to create a BP from the BuildingEscapeGameModeBase

21_be_urc

#1

I understand that the Blueprint is like a template, and that the BuildingEscapeGameModeBase is created with the project at the very beginning.

Isn’t it possible to add the new DefaultPawn_BP to the existing BuildingEscapeGameModeBase without creating a BP? Is that somehow hardcoding (presented at the beginning of the video)?

Why do we need a “template” for the GameMode if there’s only one of it in the game?
Thanks!


#2

You could do it in C++ but it’s a bit more involved if you want to set the default pawn to a blueprint class. You would have to have a string reference the blueprint’s location. Then if you ever want to change that either to a different blueprint class or by moving the blueprint’s file location you would have to update that string reference and recompile.

#include "BuildingEscapeGameMode.h"
#include "ConstructorHelpers.h"

ABuildingEscapeGameMode::ABuildingEscapeGameMode()
{
	ConstructorHelpers::FClassFinder<APawn> Blueprint = TEXT("/Game/DefaultPawn_BP");
	if (Blueprint.Class)
	{
		DefaultPawnClass = Blueprint.Class;
	}
	else
	{
		UE_LOG(LogTemp, Error, TEXT("Couldn't find default pawn blueprint asset!"))
	}
}


automatically bumped #3

#4

Thanks Dan, did this help @Ignacio_Nieto? If so please mark as Solution, if not please let us know what else we can do to help.


#5

Thanks to both! Marked the response as Solution.


closed #6

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.