Unlit Mode in packaged game

In my editor I use unlit mode without problem. When I package the game (Windows) I am unable to view with unlit mode. Here’s what I have tried so far:

  1. added r.ForceDebugViewModes=1 under [/Script/Engine.RendererSettings] in DefaultEngine.ini

  2. (in the packaged game) running the bluprint function Execute Console Command with Command = viewmode unlit.

This had no effect. Does anyone know a way to allow unlit mode in a packaged game?

I don’t know why you should want this and I also don’t think that this is possible.

Instead you should define a default light which will be shown everywhere.

To achieve this go in your level, add a post processing volume and set it to “infinite extent (unbound)”. Than choose a grey default texture as cuemap texture (under ambient cubemap). With the values of tint you can than color your scene and with intensity you can define the brightness.

This normally looks better than unlit mode, is more customizable and doesn’t need a workaround.

I hope I could help.

Try this and let me know how and if it works. You should be able to get unlit mode without using any lights in the scene.


If you get flickering issues, you might have to change the Anti-Aliasing settings in the project settings. I have it set to Fast Approximate (FXAA).

Thank you for your suggestion. I tried it but it did not work.

Some more info in case it helps:

  • I am using an orthographic camera

  • I am using lots of sprites. It’s a 2D game and the problem is that the lighting is washing out some colours and darkening others.

  • I have no lights in the scene.

  • All my materials are Shading Model=Unlit. Some are Blend mode=transparency, some are Blend mode=masked.

These information would have been great at the start, when creating a thread like this…

I recommend you edit the original post with this new information and other important information you have. At the end of the original post, write EDIT and then necessary information below. Surely the answer is out there somewhere. I cannot help you with anything 2D and sprites. Perhaps you can add a Post Process material to the camera, not sure.

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.

7 Likes

This is great! I might use this as well to get a very controlled flat lighting and shadows in 3D. Thank you for the update and if you can, mark your own reply as a solution for UE users coming here in the future.

1 Like

You can do it, if:

  1. Add (r.ForceDebugViewModes=1) → (DefaultEngine.ini)

  2. In blueprint need call (Execute Console Command),
    and write there (viewmode unlit).

01
02

Thanks bro it’s helped me a lot. As I tried your solution I want to let you know that diffuse color makes full metallic materials black but BaseColors (lighting or GBuffer) worked well it renders the material as it is in flat shading. Once again thanks.

Didn’t work :pensive:

It’s worked for me…

even with force debug viewmodes set to 1 if engine detects the build type is shipping it wont let you change to unlit mode, is there any workaround for this?