Looping background

So I am new to Unity and I am trying to make an endless runner. The problem is, I want my background image to loop and look like it is moving. I tried some coding myself but it didn’t work and with a little bit of googling I found a guy using a code for the background just like this:

public class LoopingBackground : MonoBehaviour
    public float backgroundSpeed; //How fast the background is moving
    public Renderer backgroundRenderer;
    // Start is called before the first frame update
    void Start()
        backgroundRenderer.material.mainTextureOffset += new Vector2(backgroundSpeed * Time.deltaTime, 0f);

But the thing is the background just looks like it stays still after I implemented the code above. The background sprite’s wrap mode is on repeat, it’s a child of the GameManager empty object, camera is a child of the GameManager to make the camera move on the x axis endlessly. If you need any more information tell me I can provide.

link text

This is the guy I found on the youtube. At 9:20, you can see the background movement. That’s exactly what I want to do.

You are not updating the offset every frame, you are offsetting it only once, since you call it in the Start message. The solution would be to replace Start (which is called before the first frame of Update) to Update (which runs every frame). Good luck with your endless runner!