Hello,
I created a material named ‘‘TV_Material’’. In that material, I want to make a texture offset on the U axis with a scalar parameter. I think I got that part right, because when I create a Material Instance and change the value of the scalar parameter, I see the texture offset properly in the material viewer, as well as on the mesh I apply it to in my level.
The tricky part is, I want to make it so every frame, when the character advances on the x axis (this is a 2D game), the texture of the mesh moves (offsets on the U axis) by one. So in my level, I created the following logic:
- On BeginPlay, I create a Dynamic Material instance of my material and set it as the material of the mesh in my level.
- Then, Every Tick, I check the character’s velocity. If lower than 0, then nothing. If greater than 0, then I get the scalar parameter’s value, I add 1 to it, and I make the result the new value of the parameter.
The logic works well when I print string it, and I can see the scalar parameter goes up when I move the character and stops when the character stops. The problem is, the texture isn’t moving. I tried multiple ways to troubleshoot it, and I can’t find the error in my logic. Like I said, the Scalar parameter works in the material viewer and in the scene. And the value gets updated properly when I print string it. But it’s not working.
What am I doing wrong? Here are screenshots of my setup.