my background is not scrolling why?
I have this good script but its not scrolling?
its a 2d game using UnityEngine; using System.Collections;
public class bgscroll : MonoBehaviour {
public float speed = 0.2f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
Vector2 offset = new Vector2 (Time.time * speed, 0);
GetComponent<Renderer>().material.mainTextureOffset = offset;
}
}
Comment
Best Answer
Answer by CaioMGA_ · Feb 02, 2017 at 07:28 PM
Have you set your Texture's wrap mode to "Repeat"? If not, cllick on your texture in the Hierarchy and check the Inspector tab.
wrap-mode.png
(17.9 kB)