Scrolling background from top to bottom

I already refer to a guide of scrolling background, but it loop from right to left,
what should i add or change in the script to let it loop from top to bottom?

Using the script below:

using UnityEngine;
using System.Collections;

public class Background : MonoBehaviour 
{
	public float speed = 0;
	
	void Update ()
	{
			renderer.material.mainTextureOffset = new Vector2 (Time.time * speed, 0f);
	}
}

Thx in advance.

1 Answer

1

Vector2( X, Y )

To scroll on the Y, modify the Y value

renderer.material.mainTextureOffset = new Vector2 (0f, Time.time * speed);