Hi,
I’ve done some testing with a small local multiplayer game. I spawn my second playable pawn via my C++ GameMode:
void ABrawlMode::BeginPlay()
{
Super::BeginPlay();
for (int32 i = 0; i < 1; i++)
{
UGameplayStatics::CreatePlayer(this, -1, true);
}
}
To my understanding this should spawn a second playercontroller with it’s pawn, if there are enough free player starts of course. However it does not always spawn the pawn. Sometimes I’m left with only 1 pawn created, but the second controller (including hud, playerstate, etc) is always created. It is just the pawn that is missing sometimes. I already tried to override these methods, but without any effect regarding this issue:
/** select best spawn point for player */
virtual AActor* ChoosePlayerStart_Implementation(AController* Player) override;
/** always pick new random spawn */
virtual bool ShouldSpawnAtStartSpot(AController* Player) override;
/** check if player can use spawnpoint */
virtual bool IsSpawnpointAllowed(APlayerStart* SpawnPoint, AController* Player) const;
/** check if player should use spawnpoint */
virtual bool IsSpawnpointPreferred(APlayerStart* SpawnPoint, AController* Player) const;
I did notice that when only one pawn is spawned, the second controller does have another component attached, which the first one does not have. However I don’t know what this means (referring to: PC_InactiveStateInput…)
http://puu.sh/m2GP2/bc081d7543.jpg
Can someone enlight me what I might be doing wrong?
Cheers