Can't change viewmodes in packaged build (not allowed on consoles by default)

I’m using UE 4.14.1 (source) and can’t seem to use the any of the viewmodes in a packaged build (Unlit, Wireframe, Shadercomplexity, etc…). All the Viewmodes work in the editor but in a packaged build when I type in the command “viewmode Unlit” I get the console message:

“Debug viewmodes not allowed on consoles by default. See AllowDebugViewmodes().”

Unfortunately there isn’t any documentation for AllowDebugViewmodes() and there isn’t any options to change it in the Project Settings or Editor Preferences. I’ve tried it with Build Configuration set to Debug, Development, and Shipping. I’ve also enable “Include Debug Files” in the Projects Settings.

I’m trying to use the viewmodes to troubleshoot some frame drops for Linux build. Any help would be greatly appreciated.

Hello sanford87,

From looking up the function itself in my source build, which can be found in ShaderCore.cpp, it seems that you need to set something in an .ini file for this to work. The following comment is in that function’s code:

// To use debug viewmodes on consoles, r.ForceDebugViewModes must be set to 2 in ConsoleVariables.ini

Are you packaging for Linux when you get this message or are you trying to package to a console? If it’s for Linux then this may be a bug but I’ll need to ask someone about the intended functionality.

Thanks for the response. Wow, I never would have found this.

I think it is a bug because I’ve only been packaging to Windows and Linux. I’ve been reading through the ConsoleVariables.ini but I’m a little confused on how it works. I’ve tried adding “r.ForceDebugViewModes 2” uncommented to the ConsolesVariables.ini with no luck. I’ve also tried running the command “r.ForceDebugViewModes 2” in the console but I get the error:

Error: r.ForceDebugViewModes is read only!

Thanks again for the quick response.

I got it fixed and found the answer in this forum post thank you so much for the help. Just pointing to the ShaderCore.cpp gave me something more to look into.

I simply added:
r.ForceDebugViewModes=1

to the DefaultEngine.ini under the [RenderSettings]

Really helped, works perfectly. Thanks for the solution!