How to change global shader uniform at runtime

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

I found that I can set global shader uniform at project setting/Shader Globals, but i can’t determine the way to change it at runtime by code.
How could I do this?

:bust_in_silhouette: Reply From: Ninfur

The RenderingServer has some functions to interact with global shader parameters.

Try something like:

RenderingServer.global_shader_parameter_set("param_key", value)

It does work, thanks a lot !!!

_sad_dog | 2022-12-28 14:32

1 Like