Unity2022 --> Unity6 Line renderer texture offset animation not working

Hi.

I am using an animation on my line renderer to make it look like my material is moving along the line. For that I created an animation and am changing the Material,_Main Tex_ST.z over time:

That worked fine in Unity2022.3.18f1, however, since I switched to Unity6000.0.24.f1 it stopped working all together: while the animation is still playing and the value is shown as changing, there is no visual animation on the line anymore.
Additionally, the visual got quite distorted:
(look at the little arrows going from left to right)


→

When I downgraded back to version 2022, it was working again as intended and the distortion was gone.
I couldn’t find anything in the documentation to indicate that this should stop working.

Thanks in advance :slight_smile:

2 Likes

Same problem here when calling SetTextureOffset on the material instance. Weirdly, when I select it I can see the orange object outline scrolling as normal in scene view, but nothing moves in the game.

2 Likes

Exactly the same problem here. Did anybody resolve this?

1 Like

Just upgraded from 2022.3 to 6000.4 and experienced the same problem with a LineRenderer material. The material referenced a Sprite with its TextureType set to Default and its TextureShape set to 2D. Prior to the upgrade I was able to affect the offset of the LineRenderer’s material through both the Inspector and also through code during runtime. After the upgrade neither worked.

What did work was changing the shader of the material from Universal Render Pipeline/2D/Sprite-Unlit-Default to Universal Render Pipeline/Unit. Using the Unlit shader on the LineRenderer’s material allowed me to update the offset both in the inspector and in code during runtime.

What’d I’d recommend is try changing your material’s shader, and attempt to update its offset in the inspector. If you set the Inspector to debug mode in the Inspector Options, you’ll be able to modify all of the Saved Properties for your material, and you should see whether those modifications, such as offset, are being reflected.

Hi,

I have found a solution which works for me.

Using URP/Unlit makes it possible to animate, but it would not inherit the Line Renderer colour. Since I was using a gradient that ruled it out.
Using the UI material worked, but then the renderer ordering might get messed up.

The solution for me was to create a shader graph:

  • put the Main Texture into Sample Texture 2D
  • multiply it with a default Vertex Colour node (that enables inheriting the colour inheritance)
  • put that output into the Base Colour of the Master node (Fragment)

To get the animation:

  • create a tiling and offset node into teh UV input for the Sample Texture 2D
  • put a Vector2 into the offset
  • pipe time value into the input of the vector2
    – I did some sine and abs math on it first to get it flowing

altneratively to the time math, you can plug in an Offset argument, expose it as a property and set it via a script, but that was not necessary for me.

1 Like