Having the game look like the "Unlit" option in the viewport

It’s probably a silly question, but I’m currently toying around with different styles for my game and I was wondering if there was a way to achieve something like the “Unlit” view mode option you have in the viewport of UE4 in game? I know you can change the Shading Model of a material to Unlit, but it loses the ambient occlusion.

(Will post images later if needed, Imgur is derping out at the moment…)

Thanks!

1 Like

Try an ambient cubemap -Post Process Effects in Unreal Engine | Unreal Engine 5.2 Documentation - and plug a plain white texture into it. If there are no other lights in the scene, you should be able to get what you want, with AO as well.

Edit: oooor you can use a skylight the same way, using a pure white cubemap. Might look nice, particularly if you enable “casts shadows”

1 Like

Try typing in the console “viewmode unlit” when in game mode.
Just learned this just now too, and it works. :wink:

5 Likes

Will this also work in a shipped build?

Hey I’m a total beginner and had the same question.
I found a simple solution that worked for me.
Just set the Shading Model of my Objects in the Material Editor from Default Lit to Unlit and Tadaaaa the whole world looks flat :slight_smile:

Probably not the best way if you already have built a complex scene but it works. See in this [image][1]

http://i.imgur.com/NRCm7lW.jpg

1 Like

It works in shipped. At least, worked on Android.

It did not work for me on Development build fo windows 64

Thanks, mate! That’s actually what I’ve looking for.

Is there any way to make this automatic, without having to type that command?

just change material shading model to “unlit” (as on the screenshot below) this is the correct way

Thanks, but the material shading model was already “unlit” (it’s DefaultSpriteMaterial), I just double-checked. I don’t know what I’m doing wrong :frowning:

just press F2 when playing in the viewport.

in your project’s Config Folder, open up DefaultEngine.ini Under the [RenderSettings] or [/Script/Engine.RendererSettings] add the following: r.ForceDebugViewModes=1

then use the cmd
“viewmode unlit”

The viewmode unlit does not work in shipping build. There’s a macros in C++ that prevents it from working it in shipping build. Are you shipping your game in debug build?

Here’s the handle viewmode function: https://github.com/EpicGames/UnrealEngine/blob/40eea367040d50aadd9f030ed5909fc890c159c2/Engine/Source/Runtime/Engine/Private/GameViewportClient.cpp#L3585

The part that prevents it from working in shipping build is:

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

So if you’re really shipping it in the shipping build mode, there is no way it would work.

Honestly, I don’t remember. It’s been many years. Maybe that preprocessor code was added since then? Or maybe I wasn’t publishing the game in Shipping mode haha That’s possible.