And I’ve fallen at the first hurdle and can’t get the print of Hello World to work.
Here’s my FPSGameMode.h:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/GameMode.h"
#include "FPSGameMode.generated.h"
/**
*
*/
UCLASS()
class FPSPROJECT_API AFPSGameMode : public AGameMode
{
GENERATED_UCLASS_BODY()
public:
virtual void StartPlay() override;
};
And here’s my FPSGameMode.cpp:
/// Fill out your copyright notice in the Description page of Project Settings.
#include "FPSProject.h"
#include "FPSGameMode.h"
AFPSGameMode::AFPSGameMode(const class FObjectInitializer & ObjectInitializer)
: Super(ObjectInitializer)
{
}
void AFPSGameMode::StartPlay()
{
Super::StartPlay();
StartMatch();
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("HELLO WORLD"));
}
}
Could it be as simple as the game starting before its able to receive on screen debug messages?
Try logging a message instead and see how that goes.
Personally, I use macros to make logging easier, but its up to you.
Did you set your gamemode as the default one? It probably uses whatever it’s set to now which is not AFPSGameMode so your function is not called at all.
You can manipulate this via the settings dialogs in the editor. Don’t ask me what category it’s under but you can search something along the lines of “game mode”.
Alternatively add something like this to your DefaultEngine.ini:
Hey guys thanks for the replies, I’ve double checked the default game type is definitely this new one. I also tried logging stuff but nothing works.
Heres the Output Log output:
LogPlayLevel: PIE: World Init took: (0.001079s)
LogPlayLevel: PIE: Created PIE world by copying editor world from /Game/FPSMap.FPSMap to /Game/UEDPIE_0_FPSMap.FPSMap (0.003488s)
LogInit: XAudio2 using 'Speakers (Realtek High Definition Audio)' : 2 channels at 48 kHz using 32 bits per sample (channel mask 0x3)
LogInit: FAudioDevice initialized.
LogWorld: Game class is 'FPSGameMode'
LogWorld: Bringing World /Game/UEDPIE_0_FPSMap.FPSMap up for play (max tick rate 0) at 2015.10.30-10.14.37
LogActor:Warning: GameSession /Game/UEDPIE_0_FPSMap.FPSMap:PersistentLevel.GameSession_16 has natively added scene component(s), but none of them were set as the actor's RootComponent - picking one arbitrarily
LogActor:Warning: GameNetworkManager /Game/UEDPIE_0_FPSMap.FPSMap:PersistentLevel.GameNetworkManager_16 has natively added scene component(s), but none of them were set as the actor's RootComponent - picking one arbitrarily
LogWorld: Bringing up level for play took: 0.002309
PIE: Info Play in editor start time for /Game/UEDPIE_0_FPSMap -0.339