Repeatable 2D Texture on Linerenderer

I try to create a Linerenderer (Positions update every Frame) which uses a texture that is repeated depending on the needed length.

Therefore I tried the following:

  1. Creating a reapeatable texture

71180-unbenannt.png

  1. Creating a Material (Sprite/Default Shader) which uses this texture.

71181-unbenannt2.png

  1. Changing the texture’s scale when needed:

    //Update Linderenderer
    linerenderer.SetPosition(0, transform.position);
    linerenderer.material.SetTextureScale(“_MainTex”, new Vector2(hook_joint.distance,1));
    Debug.Log(linerenderer.material.GetTextureScale(“_MainTex”));

The Debug Log shows that the texture scale changes over time, the change is however not visible?
Do i change the wrong texture on the material or is this kind of approach totaly wrong?

I allready found several answers to this question , which range from using special shaders to chaining linerenderers together (multiple linerenderers with fixed length) . Most of these answers however do not cover the use of a transparent key in the texture (my chain has holes ) or do only work in 3D.

The shader Sprites/Default does not use any of he Texture Scale functions! I changed the material shader to standart and used the Cutout rendering mode to achieve the transparancy in the chain. After that the code from above works perfectly and the line renderer displays in the correct scale at each frame.

change material shader to standard and then click on emission and choose same texture.