# Unlit Mode in packaged game

**URL:** <https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900>\
**Category:** Rendering\
**Tags:** unreal-engine, Rendering\
**Created:** [April 14, 2022, 5:49am UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900 "2022-04-14T05:49:02Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![hydr0k](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/hydr0k/32/784603_2.png) [@hydr0k](https://forums.unrealengine.com/u/hydr0k)\
**Post date:** [April 14, 2022, 5:49am UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900/1 "2022-04-14T05:49:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![HAF-Blade](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/haf-blade/32/88718_2.png) [@HAF-Blade](https://forums.unrealengine.com/u/HAF-Blade)\
**Post date:** [April 14, 2022, 6:04am UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900/2 "2022-04-14T06:04:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Engineering\_Visions](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/engineering_visions/32/470310_2.png) [@Engineering\_Visions](https://forums.unrealengine.com/u/Engineering_Visions)\
**Post date:** [April 14, 2022, 9:20am UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900/3 "2022-04-14T09:20:11Z")

</div>

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.

 ![Unlit Mode in Packaged Game - Material](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/3/b/53b90476463fd1c08ec081a5d8721d91217de643.jpeg)  
 ![Unlit Mode in Packaged Game - Post Processing Volume](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/8/0/a801e6471f5cab60de26784a630e0345cfa3e308.jpeg)

---

<div class="post-metadata">

**Author:** ![Engineering\_Visions](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/engineering_visions/32/470310_2.png) [@Engineering\_Visions](https://forums.unrealengine.com/u/Engineering_Visions)\
**Post date:** [April 14, 2022, 9:21am UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900/4 "2022-04-14T09:21:59Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![hydr0k](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/hydr0k/32/784603_2.png) [@hydr0k](https://forums.unrealengine.com/u/hydr0k)\
**Post date:** [April 14, 2022, 12:28pm UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900/5 "2022-04-14T12:28:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![HAF-Blade](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/haf-blade/32/88718_2.png) [@HAF-Blade](https://forums.unrealengine.com/u/HAF-Blade)\
**Post date:** [April 14, 2022, 4:25pm UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900/6 "2022-04-14T16:25:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Engineering\_Visions](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/engineering_visions/32/470310_2.png) [@Engineering\_Visions](https://forums.unrealengine.com/u/Engineering_Visions)\
**Post date:** [April 14, 2022, 5:26pm UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900/7 "2022-04-14T17:26:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![hydr0k](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/hydr0k/32/784603_2.png) [@hydr0k](https://forums.unrealengine.com/u/hydr0k)\
**Post date:** [April 17, 2022, 12:21am UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900/8 "2022-04-17T00:21:51Z")

</div>

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](https://forums.unrealengine.com/t/how-to-use-viewmode-unlit-in-a-shipping-build/307143/5) 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:

```auto
#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.

---

<div class="post-metadata">

**Author:** ![Engineering\_Visions](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/engineering_visions/32/470310_2.png) [@Engineering\_Visions](https://forums.unrealengine.com/u/Engineering_Visions)\
**Post date:** [April 18, 2022, 7:14am UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900/9 "2022-04-18T07:14:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![NitroCourt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NitroCourt](https://forums.unrealengine.com/u/NitroCourt)\
**Post date:** [September 21, 2023, 6:36pm UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900/11 "2023-09-21T18:36:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![muneebdev2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/muneebdev2/32/870037_2.png) [@muneebdev2](https://forums.unrealengine.com/u/muneebdev2)\
**Post date:** [January 3, 2024, 11:42am UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900/12 "2024-01-03T11:42:04Z")

</div>

Didn’t work 😔

---

<div class="post-metadata">

**Author:** ![Nizami\_Nz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nizami\_Nz](https://forums.unrealengine.com/u/Nizami_Nz)\
**Post date:** [January 4, 2024, 4:55pm UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900/13 "2024-01-04T16:55:30Z")

</div>

It’s worked for me…

---

<div class="post-metadata">

**Author:** ![tweakeroo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tweakeroo](https://forums.unrealengine.com/u/tweakeroo)\
**Post date:** [April 28, 2024, 1:56pm UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900/14 "2024-04-28T13:56:05Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ImmortaLeader](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ImmortaLeader](https://forums.unrealengine.com/u/ImmortaLeader)\
**Post date:** [September 3, 2024, 6:43pm UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900/15 "2024-09-03T18:43:59Z")

</div>

hi people who know c++, because i don’t ☹  
can you tell me how i can make EXACTLY this blueprint as c++ and have it be UNLIT ?  
my game is ready to be shipped i just need to make it unlit and i read this but don’t know how to do it.  
please give me a reply and tell me exactly where to just copy paste it to make this work.

 ![GameMode](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/d/6/ed680353ec5f368ea6fffb696255b0e3bcbf4500.jpeg)

---

<div class="post-metadata">

**Author:** ![Kulagin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kulagin](https://forums.unrealengine.com/u/Kulagin)\
**Post date:** [September 12, 2024, 6:16am UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900/16 "2024-09-12T06:16:00Z")

</div>

> [@hydr0k](#):
>
> added r.ForceDebugViewModes=1 under [/Script/Engine.RendererSettings] in DefaultEngine.ini

This was supposed to work, I guess. The console command `r.ForceDebugViewModes` is registered in the engine: [https://github.com/EpicGames/UnrealEngine/blob/40eea367040d50aadd9f030ed5909fc890c159c2/Engine/Source/Runtime/RenderCore/Private/ShaderCore.cpp#L366](https://github.com/EpicGames/UnrealEngine/blob/40eea367040d50aadd9f030ed5909fc890c159c2/Engine/Source/Runtime/RenderCore/Private/ShaderCore.cpp#L366)

But it doesn’t work, because it’s not actually used by the `viewmode` console command processing function:

[https://github.com/EpicGames/UnrealEngine/blob/40eea367040d50aadd9f030ed5909fc890c159c2/Engine/Source/Runtime/Engine/Private/GameViewportClient.cpp#L3585](https://github.com/EpicGames/UnrealEngine/blob/40eea367040d50aadd9f030ed5909fc890c159c2/Engine/Source/Runtime/Engine/Private/GameViewportClient.cpp#L3585)

Instead, what we have is:

```auto
#if UE_BUILD_TEST || UE_BUILD_SHIPPING
	Ar.Logf(TEXT("Debug viewmodes not allowed in Test or Shipping builds."));
	ViewModeIndex = VMI_Lit;
#else

```

So it just forcefully sets the view mode to lit in shipping build no matter what option you choose. So, what do we do? Well, one way is to create our own console command that actually works in all builds. Or just replicate the behavior of this Unreal function and put it in a blueprint library and call it from C++ or blueprints respectively. That’s what I intend to do now.

Here’s the solution that actually works:  
In your C++ blueprint function library(create one if you don’t already have one):  
Header:

```cpp
UFUNCTION(BlueprintCallable)
static void SetViewMode(EViewModeIndex ViewMode);

```

Source file:

```cpp
void UMyBlueprintFunctionLibrary::SetViewMode(EViewModeIndex ViewMode) {
	ApplyViewMode(ViewMode, false, GEngine->GameViewport->EngineShowFlags);
	GEngine->GameViewport->ViewModeIndex = ViewMode;
}

```

---

<div class="post-metadata">

**Author:** ![Kulagin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kulagin](https://forums.unrealengine.com/u/Kulagin)\
**Post date:** [September 12, 2024, 7:21am UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900/17 "2024-09-12T07:21:59Z")

</div>

> [@HAF-Blade](#):
>
> I don’t know why you should want this.

To make the textures look like they look when they’re created. Also better performance in 2D games. A good engine should have switches on and off for everything, so that people can configure and get the best out of it. It’s a good development approach and is known as a “feature flag”.

> [@HAF-Blade](#):
>
> and I also don’t think that this is possible

It is possible.

> [@HAF-Blade](#):
>
> Instead you should define a default light which will be shown everywhere.

Well, this will change how the textures look and they won’t look like they are when they were created. It’s very important for 2D games to preserve the original look of how it looked when they were created in image editing software.

> [@HAF-Blade](#):
>
> This normally looks better than unlit mode

Not really. It looks more different to the original look, so it’s not better, just different. Which is worse for 2D games.

---

<div class="post-metadata">

**Author:** ![Estrange](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Estrange](https://forums.unrealengine.com/u/Estrange)\
**Post date:** [September 19, 2024, 2:02am UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900/18 "2024-09-19T02:02:14Z")

</div>

Is there a way to make this work with post-processing? I’ve tried bypassing it and enabling post-processing in the engine flags, but it just turns it back to lit mode.

---

<div class="post-metadata">

**Author:** ![Kulagin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kulagin](https://forums.unrealengine.com/u/Kulagin)\
**Post date:** [September 19, 2024, 6:33am UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900/19 "2024-09-19T06:33:15Z")

</div>

Implementation of the unlit mode is just a disabled post processing: [https://github.com/EpicGames/UnrealEngine/blob/40eea367040d50aadd9f030ed5909fc890c159c2/Engine/Source/Runtime/Engine/Private/ShowFlags.cpp#L292](https://github.com/EpicGames/UnrealEngine/blob/40eea367040d50aadd9f030ed5909fc890c159c2/Engine/Source/Runtime/Engine/Private/ShowFlags.cpp#L292)

```cpp
void ApplyViewMode(EViewModeIndex ViewModeIndex, bool bPerspective, FEngineShowFlags& EngineShowFlags)
{
	bool bPostProcessing = true;

	switch(ViewModeIndex)
	{
		case VMI_Unlit:
			bPostProcessing = false;
			break;
	...
	}
	...
	EngineShowFlags.SetPostProcessing(bPostProcessing);

```

If you want to disable some specific features and leave the others, you can try switching engine flags yourself. Here’s a function to disables everything:

```cpp
void UBlueprintFunctionLibrary::DisableEngineFeatures() {
	auto& F = GEngine->GameViewport->EngineShowFlags;
	F.PostProcessing = false;
	F.Bloom = false;
	F.AntiAliasing = false;
	F.TemporalAA = false;
	F.AmbientCubemap = false;
	F.EyeAdaptation = false;
	F.GlobalIllumination = false;
	F.AmbientOcclusion = false;
	F.Decals = false;
	F.OnScreenDebug = false;
	F.PointLights = false;
	F.SpotLights = false;
	F.MotionBlur = false;
	F.CameraInterpolation = false;
	F.SeparateTranslucency = false;
	F.ScreenPercentage = false;
	F.ReflectionEnvironment = false;
	F.Specular = false;
	F.ScreenSpaceReflections = false;
	F.IndirectLightingCache = false;
	F.TexturedLightProfiles = false;
	F.LightFunctions = false;
	F.InstancedStaticMeshes = false;
	F.InstancedFoliage = false;
	F.InstancedGrass = false;
	F.DynamicShadows = false;
	F.Particles = false;
	F.SkeletalMeshes = false;
	F.Translucency = false;
	F.LOD = false;
	F.Lighting = false;
	F.DeferredLighting = false;
	F.StaticMeshes = false;
	F.Landscape = false;
	F.Fog = false;
	F.Game = false;
	F.BSP = false;
	F.LightShafts = false;
	F.VolumetricFog = false;
	F.TextRender = false;
	F.Rendering = false;
	F.HMDDistortion = false;
	F.StereoRendering = false;
	F.DistanceCulledPrimitives = false;
	F.SkyLighting = false;
	F.Paper2DSprites = false;
	F.ScreenSpaceAO = false;
	F.DistanceFieldAO = false;
}

```

But be aware, this disables everything, the whole rendering `F.Rendering = false`. You won’t see anything. So only use and disable the ones that you want to disable. There are some flags here for the lights, that might be what you want without disabling all the post processing functions.

---

<div class="post-metadata">

**Author:** ![ronrodgerss](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ronrodgerss/32/978966_2.png) [@ronrodgerss](https://forums.unrealengine.com/u/ronrodgerss)\
**Post date:** [September 19, 2024, 4:50pm UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900/20 "2024-09-19T16:50:11Z")

</div>

I see that everyone has a very good answer to the above problem. I have wondered for a long time. Thanks to everyone’s answers, I have the answer to my problem.

---

<div class="post-metadata">

**Author:** ![PixelatedCall](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pixelatedcall/32/982657_2.png) [@PixelatedCall](https://forums.unrealengine.com/u/PixelatedCall)\
**Post date:** [October 1, 2024, 5:17pm UTC](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900/21 "2024-10-01T17:17:01Z")

</div>

I tried your code on this project but couldn’t get it to work. What changes should I have made?  
[YouTube Video](https://www.youtube.com/watch?v=3pbLfvg5cUc)

[Next page](https://forums.unrealengine.com/t/unlit-mode-in-packaged-game/527900.md?page=2)
