Change world setting variable at runtime

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 :slight_smile: )?

Edit: Nevermind I figured it out.

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

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.

1 Like

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

2 Likes

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