shader refuses to deactivate

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

I’m trying to create a hit effect using shader and animationPlayer. However, though this works on the player. It does not work on the enemy because everytime I deactivate the shader and save, it activates again when I restart the engine.

this is the shader’s code

shader_type canvas_item;
uniform bool active = false;
void fragment(){
	vec4 previous_colour = texture(TEXTURE, UV);
	vec4 white = vec4(1.0,1.0,1.0,previous_colour.a);
	vec4 new_colour = previous_colour;
	if(active == true){
		new_colour = white;
	COLOR = new_colour;

although I don’t think there is problem with it as it works perfectly with my player.

Do you have a ‘RESET’ animation that’s perhaps re-enabling the shader?

spaceyjase | 2023-03-28 11:21

Yes there is! Thank you!

D.Q.Li | 2023-03-28 11:29