# Disabling Lumen Through Code

**URL:** <https://forums.unrealengine.com/t/disabling-lumen-through-code/674951>\
**Category:** Pipeline & Plugins\
**Tags:** unreal-engine, UE5-0, Plugins, question\
**Created:** [October 22, 2022, 6:18pm UTC](https://forums.unrealengine.com/t/disabling-lumen-through-code/674951 "2022-10-22T18:18:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dudebat923](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dudebat923/32/699029_2.png) [@dudebat923](https://forums.unrealengine.com/u/dudebat923)\
**Post date:** [October 22, 2022, 6:18pm UTC](https://forums.unrealengine.com/t/disabling-lumen-through-code/674951/1 "2022-10-22T18:18:19Z")

</div>

Hey guys,

I don’t use Lumen. I don’t think it’s particularly performant yet so I stick to baked lighting. It’s getting really tedious to go through the project settings and change stuff every time I open a project, so I’m trying to make a toolbar plugin where I click a button and it changes the settings for me, specifically the Dynamic Global Illumination Method and Reflection Method settings. I’ve been going through the engine’s source code, documentation, and whatever else I could find online, and I can’t seem to change these settings in C++. does anyone know if it’s even possible and if so how to do it?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 22, 2022, 7:04pm UTC](https://forums.unrealengine.com/t/disabling-lumen-through-code/674951/2 "2022-10-22T19:04:52Z")

</div>

What about?

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/1/c/21ce7a65acabc0e3842b68f4443194dec50b326a.png)

---

<div class="post-metadata">

**Author:** ![dudebat923](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dudebat923/32/699029_2.png) [@dudebat923](https://forums.unrealengine.com/u/dudebat923)\
**Post date:** [October 22, 2022, 7:35pm UTC](https://forums.unrealengine.com/t/disabling-lumen-through-code/674951/3 "2022-10-22T19:35:17Z")

</div>

How do I do that in C++?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 22, 2022, 8:06pm UTC](https://forums.unrealengine.com/t/disabling-lumen-through-code/674951/4 "2022-10-22T20:06:34Z")

</div>

> [@How do i run a Console Command in C++](https://forums.unrealengine.com/t/how-do-i-run-a-console-command-in-c/317988/2):
>
> Exec() takes in parameter a const TCHAR\*. But, TEXT(SomeString) does not perform FString conversion to const TCHAR\*. To do this, you have to use the \* operator. So, try this instead: GetWorld()-\>Exec(GetWorld(), \*Final); TEXT(“some text”) should only be used to make a const TCHAR\* for litterals (i.e. defining a string with quotes). Final is a FString, not a litteral. At a lower level, TEXT() adds a L before the litteral, to tell the compiler that the string is in wide char, as described in [thi…](http://en.cppreference.com/w/cpp/language/string_literal)

---

<div class="post-metadata">

**Author:** ![dudebat923](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dudebat923/32/699029_2.png) [@dudebat923](https://forums.unrealengine.com/u/dudebat923)\
**Post date:** [October 22, 2022, 9:14pm UTC](https://forums.unrealengine.com/t/disabling-lumen-through-code/674951/5 "2022-10-22T21:14:47Z")

</div>

That doesn’t seem to work. My class isn’t an actor, it’s an empty class, so I can’t use GetWorld. I’m also really confused about the \*Final and TEXT() stuff.

---

<div class="post-metadata">

**Author:** ![Ligazetom](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ligazetom](https://forums.unrealengine.com/u/Ligazetom)\
**Post date:** [October 22, 2022, 9:35pm UTC](https://forums.unrealengine.com/t/disabling-lumen-through-code/674951/6 "2022-10-22T21:35:00Z")

</div>

Well you need to read up on FString-s then.

If you look into the definition of that function it is basically calling "GEngine-\>Exec(UWorld, Command);

Just because you have empty class does not mean you cannot store the reference to UWorld there anyway, since it is obviously needed to execute commandline commands. I believe you are intancing it somewhere where there is some way of getting the reference that can be passed along.

The FString and TEXT has something to do with text encodings. Crash course: UTF-16 string literals are created by using “L” before any string literal you type in code e.g. ‘L"This is utf16 encoded string"’ TEXT - macro is macro that depending on the settings will either put the ‘L’ there or won’t so you can create either const wchar\_t\* or const char\* just by changing one define somewhere. (Windows has \_T())… FString has overloaded operator\* so when you use _FString() you’ll get underlying data as const TCHAR_… TCHAR is again type that is either char or wchar\_t depending on the previously mentioned settings.

---

<div class="post-metadata">

**Author:** ![dudebat923](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dudebat923/32/699029_2.png) [@dudebat923](https://forums.unrealengine.com/u/dudebat923)\
**Post date:** [October 22, 2022, 9:53pm UTC](https://forums.unrealengine.com/t/disabling-lumen-through-code/674951/7 "2022-10-22T21:53:49Z")

</div>

This is the variable I’m trying to change:

 ![GIVariable](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/4/9/24944fbafe9f2d70e98ea8a2ef5b6e41ef2c9e9e.png)

This is my code:

 ![MyCode](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/a/7/ea79e2af5d2a39dbf9f3f9c7533b3a6359d003d0.png)

I am not certain why that doesn’t work. It acts like the DynamicGlobalIllumination variable doesn’t exist… but clearly it does.
