Hey guys , I’m trying to make a 2D endless runner game. It has a top down view , and I’m trying to make the road endless. I could use a queue , but I opted to just scroll the texture over and over so it looks like its moving. I have two quads , side by side with road pictures on them to make them look like a road. However , my code just moves the quads entirely instead of scrolling them. Eventually I will add a player character , and you have to dodge cars , puddles etc and collect coins etc. So is a queue or a scrolled texture better?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RoadControl : MonoBehaviour {
float speed = .5f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
float offset = Time.time * speed;
GetComponent<Renderer>().material.mainTextureOffset = new Vector2(0, -offset);
}
}
// scrolls texture of road
What do you guys suggest I do? Should I make a queue ( if so , help me out , I’m not too sure how to code that)
Or is my code incorrect and it’s possible to just scroll the texture?
