WorldEnvironment Node Returning Null

Godot Version

v4.2.1.stable.official [b09f793f5]

Question

I’m trying to script a graphics quality variable, and I’ve set up a simple decision tree to enable and disable certain effects at certain levels. When I try to change the effects, the debugger reports it as an “Attempt to call function ‘set_glow_enabled’ in base ‘null instance’ on a null instance.”
I’ve tried using these so far:

@onready var rendnode = self
@onready var rendnode = $PostProcessing
@onready var rendnode = $PostProcessing.environment

And I’ve tried changing the effects with:
rendnode.environment.set_glow_enabled(false)
rendnode.environment.glow_enabled = false

IMPORTANT EDIT: The error only occurs when I set the script to autoload.

Could anyone explain what this means? I’ve attached an image of my code (with alternatives I’ve attempted as comments) below.

By the way, the script is attached to the WorldEnvironment node, titled PostProcessing.

What node is the script on? I can’t tell from the image.

Whoops. The script is attached to the WorldEnvironment node, titled PostProcessing.

As it turns out, this problem was easily fixed by calling the global variable in another script.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.