High Level: Tutorial provides sample C++ code. Code is now invalid due to ongoing work with engine.
Specific:
-
Tutorial does not instruct user to include Engine.h in the FPSProjectGameMode header file.
-
Tutorial instructs user to access GEngine in FPSProjectGameMode.cpp
-
GEngine is not accessible w/o header file. User cannot compile game.
Code for Header
#pragma once
#include "GameFramework/GameModeBase.h"
#include "FPSGameMode.generated.h"
UCLASS()
class FPSPROJECT_API AFPSProjectGameMode : public AGameModeBase
{
GENERATED_BODY()
virtual void StartPlay() override;
};
Code for CPP file, StartPlay method
void AFPSProjectGameMode::StartPlay()
{
Super::StartPlay();
if (GEngine)
{
// Display a debug message for five seconds.
// The -1 "Key" value (first argument) indicates that we will never need to update or refresh this message.
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Yellow, TEXT("Hello World, this is FPSGameMode!"));
}
}