Unlit Mode in packaged game

Hey guys, thought I’d pop in with an update and solution.

I found a solution here: How to use viewmode unlit in a shipping build? - #5 by Shadowriver and then added a bit to meet my needs.

In my GameModeBase.cpp I set the ViewModeIndex of the GameViewport to Enum 2 (unlit). The post I linked above has more details on the different modes you can select.

In addition, I disabled tonemappers because they were causing my sprite colours to be too dark. Below is the final GameModebase.cpp:

#include "KioGameMode.h"
#include "Engine/World.h"
#include "Kismet/GameplayStatics.h"

// Called when the game starts or when spawned
void GameModeBase::BeginPlay()
{
	Super::BeginPlay();

	UGameViewportClient* GameViewport =  GetWorld()->GetGameViewport();
	GameViewport->ViewModeIndex = 2;

	APlayerController* PlayerController = UGameplayStatics::GetPlayerController(GetWorld(), 0);

	// The command being executed.
	FString Command = "ShowFlag.Tonemapper 0";
	PlayerController->ConsoleCommand(*Command);

	// The below commands are for the shipping
	// build.
	Command = "r.TonemapperGamma 0";
	PlayerController->ConsoleCommand(*Command);

	Command = "r.TonemapperFilm 0";
	PlayerController->ConsoleCommand(*Command);

	Command = "r.Tonemapper.Sharpen 0";
	PlayerController->ConsoleCommand(*Command);

	Command = "r.Tonemapper.GrainQuantization 0";
	PlayerController->ConsoleCommand(*Command);

	Command = "r.Tonemapper.Quality 0";
	PlayerController->ConsoleCommand(*Command);

}

Thanks to those who commented and bumped my topic.

10 Likes