I have a material which uses a shader in godot4(first stable release) and this is the code for the shader:
shader_type canvas_item;
uniform sampler2D custom_texture;
uniform float cutoff: hint_range(0, 1) = 1;
uniform float smoothness: hint_range(0, 1) = 0.1;
uniform vec3 color = vec3(0, 0, 0);
uniform bool inverted = false;
uniform bool linear_fade = true;
void fragment() {
if (!linear_fade) {
float value = texture(custom_texture, UV).r;
if (inverted) {
value = 1.0 - value;
}
float alpha = smoothstep(cutoff, cutoff + smoothness, value * (1.0 - smoothness) + smoothness);
COLOR = vec4(color.rgb, alpha);
} else {
COLOR = vec4(color.rgb, (1.0 - cutoff));
}
}
After I run my game scene with this shader attached to a color rect, I get this warning message multiple times:
W 0:00:01:0839 _set: This material (containing shader with path: 'res://addons/scene_manager/scene_manager.tres::Shader_vksmm') uses an old deprecated parameter names. Consider re-saving this resource (or scene which contains it) in order for it to continue working in future versions.
<C++ Source> scene/resources/material.cpp:184 @ _set()
If you want to actually create this error message by yourself and see what is happening, you can clone scene_manager repository(which is an addon for godot) and run its demo to see the original problem I'm dealing with.
Thanks everyone who is helping me on this.
Someone actually answered the question but not in here, answer is in this github issue thread of scene manager project and all credits to that guy.
problem is not related to shader code or material or even the ColorRect, that I mentioned in the question, but it is instead related to an AnimationPlayer that I had into my scene that was changing some variables of my shader code.
Take a look at the parameter name that is mentioned on the left side:
material:shader_param/cutoff
All you have to do is to change the param
part to parameter
. like this:
material:shader_parameter/cutoff
Apply this for all of your other animations and problem solved.
@LukeDaDuke