# Apply config changes edited at runtime (C++)

**URL:** <https://forums.unrealengine.com/t/apply-config-changes-edited-at-runtime-c/752802>\
**Category:** C++\
**Tags:** project-settings, unreal-engine, config, CPP, question\
**Created:** [January 19, 2023, 12:14pm UTC](https://forums.unrealengine.com/t/apply-config-changes-edited-at-runtime-c/752802 "2023-01-19T12:14:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anti-Wisdom](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/anti-wisdom/32/575220_2.png) [@Anti-Wisdom](https://forums.unrealengine.com/u/Anti-Wisdom)\
**Post date:** [January 19, 2023, 12:14pm UTC](https://forums.unrealengine.com/t/apply-config-changes-edited-at-runtime-c/752802/1 "2023-01-19T12:14:06Z")

</div>

So I’ve figured out how to make changes to config files such as DefaultEngine.ini and in this case im making a plugin that depends on some features being enabled in the Project Settings such as CustomDepthStencil.

Using the following code:

```auto
URendererSettings* StencilSettings = GetMutableDefault<URendererSettings>();
StencilSettings->CustomDepthStencil = ECustomDepthStencil::EnabledWithStencil;
StencilSettings->SaveConfig();

```

I can change this value in the config files, however this is not yet applied to the currently-running game. I have to restart the game for these changes to actually take effect.

How can I apply these changes to the game that is currently running, or update them in the version of the config that is currently loaded into memory?

---

<div class="post-metadata">

**Author:** ![Chatouille](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chatouille/32/1194622_2.png) [@Chatouille](https://forums.unrealengine.com/u/Chatouille)\
**Post date:** [January 19, 2023, 2:59pm UTC](https://forums.unrealengine.com/t/apply-config-changes-edited-at-runtime-c/752802/2 "2023-01-19T14:59:26Z")

</div>

That config variable is bound to a CVar named “r.CustomDepth”, so you can try the following :

```cpp
if (IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.CustomDepth")))
{
	CVar->Set(ECustomDepthStencil::EnabledWithStencil, EConsoleVariableFlags::ECVF_SetBySystemSettingsIni);
}

```

---

<div class="post-metadata">

**Author:** ![Anti-Wisdom](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/anti-wisdom/32/575220_2.png) [@Anti-Wisdom](https://forums.unrealengine.com/u/Anti-Wisdom)\
**Post date:** [January 19, 2023, 3:16pm UTC](https://forums.unrealengine.com/t/apply-config-changes-edited-at-runtime-c/752802/3 "2023-01-19T15:16:07Z")

</div>

Worked like a charm, looks like I finally know where at least part of these config variables go in memory!
