How to change Anisotropic Filter from script?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Liemaeu
ProjectSettings.set_setting("rendering/quality/filters/anisotropic_filter_level", 16)
ProjectSettings.save()

Doesn’t change anything, even after restarting the game.

That call to save() should store the value in the project.godot file. Can you verify whether that’s happening?

jgodfrey | 2020-10-29 16:42

No, it is not saved for a reason. It’s not in project.godot file.

Liemaeu | 2020-10-29 17:41

Using Godot 3.2.1 stable.official on Windows 10…

I just added (via cut/paste) your two posted code lines to the _ready() function of a scene script. Running that scene immediately updates my project.godot file with the following info:

[rendering]

quality/filters/anisotropic_filter_level=16

Hmmm…

However, when I click back on the Godot editor window (even with the scene still running), that information is immediately removed from the file. Not sure what that means…

jgodfrey | 2020-10-29 18:47

I’ve found that changes made in external editors to project files get overriden by Godot if the editor is open. Perhaps that’s what’s happening, the editor notices a difference between the project file and its cached copy, and prefers the cached one.

Bernard Cloutier | 2020-10-29 19:37

Thank you! I will try this in the exported game.

Is there any other/better way for implementing anisotropic filter settings in the graphics options?

Liemaeu | 2020-10-30 08:07

I assume you’re aware, but to be sure…

You can set the value from the Editor, via:

Project | Project Settings | Rendering | Quality | Anisotropic Filter Level

jgodfrey | 2020-10-30 16:53

Yes but I want to add it to my ingame graphics settings.

Liemaeu | 2020-10-31 12:39