I’m creating an endless runner. This is the script which deals with moving the tiles/road, there are 3 road game objects within the array. I’m getting a small gap in the road when the road is moved back to firstQueuedTile Vector variable. Not sure how to solve this issue anyone got any ideas?
private GameManager gameManagerScript;
[SerializeField] private GameObject[] road;
public float outOfRangeX = -100;
public Vector3 firstQueuedTile;
// Start is called before the first frame update
void Start()
{
gameManagerScript = GameObject.Find("Game Manager").GetComponent<GameManager>();
}
// Update is called once per frame
void Update()
{
for (int i = 0; i < road.Length; i++ )
{
road_.transform.position += (transform.right * Time.deltaTime * -gameManagerScript.speed);_
if (road*.transform.position.x <= outOfRangeX)*
{
road*.transform.position = firstQueuedTile;*
}
}
}