Shaders Question, how to set new Parameters with GDScript

Godot Version

4.2

Question

I get an error if i try to set a new parameter in my shader

shader Code: 

shader_type canvas_item;

uniform vec4 origin_1: source_color;
uniform vec4 new_color_1: source_color;


void fragment() {
	vec4 current_pixel = texture(TEXTURE, UV);
	if (current_pixel == origin_1)
		COLOR = (new_color_1 );
	else
		COLOR = current_pixel;
}

GDScript:

	if Input.is_action_just_pressed("DEBUG_KEY_5"):
		animated_sprite.material.set_shader_param("origin_1",Color(0.043, 0.576, 0.812))
		animated_sprite.material.set_shader_param("new_color_1", Color(0.821, 0.302, 0.439))

The Error: Nonexistent function “Set_shader_param” in base “ShaderMaterial”

set_shader_parameter missing the “eter” at the end

1 Like

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