How do i make custom GameState work?

Abdul Hasan Ali
Tue, 21 Jan 2020 20:44:21 +0000
C++

I added a custom GameState class that overrides the AGameState class.
I just added the following code:

 ATanksGameState::ATanksGameState()
    {
    }

void ATanksGameState::HandleBeginPlay()
{
	Super::HandleBeginPlay();
	GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Green, FString::Printf(TEXT("state begin play")));
}

The message is printed when i start the game, but i don’t possess any player anymore or anything. Basically nothing works anymore. Do i have to change something related to the gamemode class or something else?

I still have the default gamemode class, that inherits gamemodebase, and added no code to it.

Any help is appreciated.

2 posts - 1 participant