1. 新建c++工程
2. 打开world setting
3. 修改默认GamePlay
4. 依次新建对应GamePlay替换默认GamePlay
Default Pawn
HUD
PlayerController
GameState
PlayerState
SpectatorPawn
5. 添加AhellogpGameModeBase默认构造函数
#include "hellogpGameModeBase.h"
#include "HelloGameStateBase.h"
#include "HelloPlayerController.h"
#include "HelloPlayerState.h"
#include "HelloHUD.h"
#include "HelloPawn.h"
#include "HelloSpectatorPawn.h"
AhellogpGameModeBase::AhellogpGameModeBase()
{
GameStateClass = AHelloGameStateBase::StaticClass();
PlayerControllerClass = AHelloPlayerController::StaticClass();
PlayerStateClass = AHelloPlayerState::StaticClass();
HUDClass = AHelloHUD::StaticClass();
DefaultPawnClass = AHelloPawn::StaticClass();
SpectatorClass = AHelloSpectatorPawn::StaticClass();
}