I'm trying to make a sort of sliding effect for a sprite in my game. I took this code which I had used before in another project and copy and pasted it but this time it stopped working. In the previous project this code was used on a TextureRect, but this time I'm using it on a sprite2D, so that may be the problem and if so how would I change it to get the same effect? The error it gives me just says "Constants cannot be modified". Here is the code from the gdshader file:

`
shader_type canvas_item;

void fragment() {
UV.y += TIME * 0.1;
}
`

  • xyz replied to this.

    PizzaHutsAlat

    COLOR = texture(TEXTURE, UV + vec2(TIME, 0.0));