Language:
Page Info
Skill Level:
Engine Version:

1.5 - Setting the Default Game Mode

Now that we've successfully extended our newly modified Game Mode to Blueprints, we'll need to set our project to use BP_FPSProjectGameMode as the default Game Mode in this step.

  1. In the Edit menu, click on Project Settings.

  2. Under the Project heading on the left side of the Project Settings tab, click on Maps & Modes.

  3. Select BP_FPSGameMode in the Default GameMode dropdown menu.

    SettingFPSGameMode.png

  4. Close the Project Settings menu.

  5. Click the Play button in the Level Editor Toolbar. "Hello World, this is FPSGameMode!" should now be displayed in yellow text for five seconds in the upper left hand corner of your viewport.

    SectionResult.png

  6. Press the Escape key or click the Stop button in the Level Editor to exit Play in Editor (PIE) mode.

Finished Section Code

FPSProjectGameMode.h

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "GameFramework/GameModeBase.h"
#include "FPSProjectGameMode.generated.h"

/**
 * 
 */
UCLASS()
class FPSPROJECT_API AFPSProjectGameMode : public AGameModeBase
{
    GENERATED_BODY()

    virtual void StartPlay() override;
};

FPSProjectGameMode.cpp

// Fill out your copyright notice in the Description page of Project Settings.

#include "FPSProject.h"
#include "FPSProjectGameMode.h"

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!"));
    }
}

Congratulations! You've learned how to:

✓ Set up a New Project
✓ Open your Project in Visual Studio
✓ Add Log Messaging to your Project
✓ Compile your First C++ Class
✓ Set the Default Game Mode

You're now ready to learn how to implement your character in the next section.