GameMode
获取GameMode方法有很多,我用过如下方法,游戏运行没问题,但是在打包的时候有时候会提示错误:
AFlatPeachGameModeBase* gamemode = Cast<AFlatPeachGameModeBase>(UGameplayStatics::GetGameMode(GetWorld()));
但是用同样的方法获取PlayController时就不会有问题,我也不太清楚,代码如下:
AMyPlayerController *gameCon = Cast<AMyPlayerController>(UGameplayStatics::GetPlayerController(GetWorld(), 0));
-这里记录的是另一种方法,使用BlueprintFunctionLibrary。