How can I change Viewmode in game?

How should I switch unlit mode in a packaged game?
In the ue4 editor, I can press F2 to switch to unlit mode, but not in the packaged game.
How can I do it?

You can get that effect by using a post process volume material.

  1. Create a new material
  2. In the Details pane under “Material”, set the Domain to “Post Process”
  3. In the material, connect a “Scene Texture” node to the emissive color slot of the material
  4. Set the “Scene Texture ID” parameter of the SceneTexture node to “Diffuse Color”
  5. Add the newly created post process material as a material in your level’s post process volume.

You can use blueprints to set how much the post process material affects the scene, so you can toggle between lit and unlit at runtime.

ERROR…

What error are you getting? There are a few caveats:

  • It won’t work if you are using forward rendering
  • I won’t work for things like volumetrics, or the UE4 SkySphere blueprint
  • If you want to match the colors, you’ll have to gamma correct the SceneTexture. You can do so by plugging the SceneTexture node into the Base Input of a Power Node, setting the expononent to .4545, then plugging the output of the power node to the material’s emissive color.