Hey guys,
I’ve been trying to follow the First Person Shooter tutorial (A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums) and am having trouble getting my customer character to get spawned as the default pawn. It seems that no matter what I try, the default pawn remains “SpectatorPawn” when I play the game. Here is what some of my classes look like:
MyGameMode.cpp
#include "FromScratch.h"
#include "MyGameMode.h"
#include "TestCharacter.h"
AMyGameMode::AMyGameMode(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
DefaultPawnClass = ATestCharacter::StaticClass();
}
void AMyGameMode::StartPlay()
{
Super::BeginPlay();
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("HELLO WORLD"));
}
}
TestCharacter.cpp
#include "FromScratch.h"
#include "TestCharacter.h"
ATestCharacter::ATestCharacter(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
}
void ATestCharacter::BeginPlay()
{
Super::BeginPlay();
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("We are using TestCharacter!"));
}
}
And my project settings is showing that the gameplay mode is set to “MyGameMode” and that “TestCharacter” is the default pawn class.
I’ve also changed “World Settings” to use “MyGameMode” as the GameModeOverride and “TestCharacter” is showing up as the Default Pawn Class in that menu.
Any help would be great.
Thanks,
David