Change rendering settings from code.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Nv7-GitHub

I am trying to change rendering quality from my game, namely the Msaa filter, in rendering/quality/filters/msaa and the Allow Hidpi setting in display/window/dpi/allow_hidpi. I have tried the following code:

ProjectSettings.set_setting("display/window/dpi/allow_hidpi", true)
ProjectSettings.save()

But it does not do anything, even when I stop it and restart it. The setting is not changed. I also am wondering, how do you change the msaa filter? I am not able to disable it by the code:

ProjectSettings.set_setting("rendering/quality/filters/msaa", 0)

or enable it by the code:

ProjectSettings.set_setting("rendering/quality/filters/msaa", 16)

again, I am running ProjectSettings.save().

:bust_in_silhouette: Reply From: Nv7-GitHub

I found the answer. To do this, create a ConfigFile and save it to the directory of the executable. Name the ConfigFile “override.cfg”.

You can also change MSAA at run-time by modifying the root viewport’s msaa property (get_viewport().msaa).

Calinou | 2020-07-25 10:31