# Change world setting variable at runtime

**URL:** <https://forums.unrealengine.com/t/change-world-setting-variable-at-runtime/16245>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [December 1, 2014, 6:58am UTC](https://forums.unrealengine.com/t/change-world-setting-variable-at-runtime/16245 "2014-12-01T06:58:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![BlueByLiquid](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BlueByLiquid](https://forums.unrealengine.com/u/BlueByLiquid)\
**Post date:** [December 1, 2014, 6:58am UTC](https://forums.unrealengine.com/t/change-world-setting-variable-at-runtime/16245/1 "2014-12-01T06:58:20Z")

</div>

I would prefer doing this by BP but if I can only do it via C++ that is fine. I simply can’t find a way to change any of the world settings in BP because I can’t get a reference to the world settings.

How do you get a reference to the WorldSettings class in a BP or C++ (or both 🙂 )?

Edit: Nevermind I figured it out.

---

<div class="post-metadata">

**Author:** ![nameLive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nameLive](https://forums.unrealengine.com/u/nameLive)\
**Post date:** [July 29, 2016, 8:26am UTC](https://forums.unrealengine.com/t/change-world-setting-variable-at-runtime/16245/2 "2016-07-29T08:26:20Z")

</div>

Please share how you figured it out, looking to get reference to WorldSettings in c++ as well so i can manipulate gravity Z

---

<div class="post-metadata">

**Author:** ![UnrealEverything](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UnrealEverything](https://forums.unrealengine.com/u/UnrealEverything)\
**Post date:** [July 29, 2016, 11:36am UTC](https://forums.unrealengine.com/t/change-world-setting-variable-at-runtime/16245/3 "2016-07-29T11:36:04Z")

</div>

In C++ you can use UWorld::GetWorldSettings or AActor::GetWorldSettings. Neither is directly exposed to Blueprint though as far as I can tell. However in Blueprint you should still be able to get the WorldSettings actor by using a “Get All Actors Of Class” node. Note that these types of nodes may have a performance impact if you run them too frequently (for example in tick). You should therefore probably do that once and store the result for use later on.

---

<div class="post-metadata">

**Author:** ![Stiian](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Stiian](https://forums.unrealengine.com/u/Stiian)\
**Post date:** [February 16, 2020, 9:15am UTC](https://forums.unrealengine.com/t/change-world-setting-variable-at-runtime/16245/4 "2020-02-16T09:15:15Z")

</div>

> [@BlueByLiquid](#):
>
> Edit: Nevermind I figured it out.

You know, people like you make this world a pretty bad place to live sometimes.

---

<div class="post-metadata">

**Author:** ![GarnerP57](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GarnerP57](https://forums.unrealengine.com/u/GarnerP57)\
**Post date:** [February 16, 2020, 10:17am UTC](https://forums.unrealengine.com/t/change-world-setting-variable-at-runtime/16245/5 "2020-02-16T10:17:36Z")

</div>

The default WorldSetting variables are ReadOnly so Blueprint can’t change it but C++ can.
