How to set project settings via C++?

Is there a way to assign/create input settings via C++?
Im talking about setting the Inputs that get set in the Project Settings. (MoveForward - “A” - Value 1), not the action binding.

Id like to create a template code that I can add to the gamemode which will create the inputs(when game starts), which I can later use when I create my character class and bind what was created.

side question:
In general, how do I get/set things in the project settings? ie, DefaultPawn, Physics Settings(Gravity Z, 2d Physics)…and so on.



Have a look at Rama’s keybinding tutorial - it contains the functionality you need.

As for the side question, I have no idea - I think in UE3 there were ini file settings for some of those, maybe worth having a look.

Here’s example code to answer the side question.

URendererSettings* Settings = GetMutableDefault<URendererSettings>();
Settings->CustomDepthStencil = ECustomDepthStencil::EnabledWithStencil;

This changes Project Settings > Engine > Rendering > Postprocessing > Custom Depth-Stencil Pass to Enabled with Stencil.

All project settings are UCLASSES with types that you can edit. You just have to find out which class your setting belongs to and the get it with GetMutableDefault and then set your property’s value and save.

I found out which class the Custom Depth-Stencil Pass setting was in by searching for the tooltip (surrounded by double quotes so you search for the complete line and not key words) you get when you hover over the setting in the Unreal Engine github repository. I searched for “Whether the custom depth pass” and found out that the Custom Depth-Stencil Pass setting was in Engine/Source/Runtime/Engine/Classes/Engine/RendererSettings.h contained in a class called URendererSettings.