Accessing shader parameters from another scene

Godot Version

4.2.2

Question

I have a world scene:
image
and a hud scene:
image
in the player script i want to acces the shader parameters from speedlines in the hud scene i looked throught the topics but i could not find an answer

TIP: Doesn’t make any sense to mix PascalCase and snake_case, you should stop that.

You need to reference the HUD scene in the World scene somehow.

# Replace this with whatever method you want to get the node.
@onready var speedlines = get_tree().root.get_node("Hud/SpeedLines")

Then you can set the shader parameters

Something like this:

if speedlines.material is ShaderMaterial:
    speedlines.material.set_shader_parameter("speed", 10.0)

i just moved it into the same scene because it would return a null value now it works

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