Download

Change APawn Spawn

I have a Pawn class for a player and I would like to change its spawn location withing its Player Controller with C++.

This is what I have in Controller_OpenWorld.cpp:

#include “Controller_OpenWorld.h”
#include “Engine.h”

AController_OpenWorld::AController_OpenWorld()
{
defaultSpawn = FVector(0.0f, 0.0f, 700.0f);
SetSpawnLocation(defaultSpawn);
GEngine->AddOnScreenDebugMessage(1, 10.0f, FColor::Green,“Working”);
}

It currently does indicate that the controller works, but it does not change the spawn.

What’s the proper way to changing the spawn of a pawn?