How to access input.ini in run-time and modify it?

Hi community,

I am trying to build a 3rd person camera rotation like GTA has. When you are in free camera, you have a set of configuration (dead zone, sensitivity, exponent), and when you are aiming, you have another set. In order to achieve it, I have to modify the input.ini file. I learned I can’t do that in Blueprint. How can I do it with C++?

Thanks!

1. Method One:

Create an UClass with the settings you need:



UCLASS(config=Input)
class UMySettings : public UObject
{
	GENERATED_BODY()

	UPROPERTY(config)
	float MyConfigValue;

	// ... more settings
};


Then you can access your settings like that:



UMySettings *Settings = GetMutableDefault<UMySettings>();
float Blah = Settings->MyConfigValue;
Settings->MyConfigValue = 42.0f;


To write new values to the config file use:



Settings->SaveConfig();


2. Method Two:

Read and write config values directly. To learn more about this method read this awesome article:
A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums,Read%26_Write_to_Config_Files