So i am pretty new on Unity and i found this tutorial
and i tried to make the same process on my android game project but nothing happened.I think my problem is about the cylinder.Because i am using cylinder instead of tile.I will be so glad if you guys help me.Here is my map;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CylinderManager : MonoBehaviour
{
public GameObject[] cylinderPrefabs;
private Transform playerTransform;
private float spawnZ = 0.0f;
private float cylinderLength = 30.0f;
private int amnCylindersOnScreen = 7;
// Use this for initialization
private void Start () {
playerTransform = GameObject.FindGameObjectWithTag ("Player").transform;
for (int i = 0; i < amnCylindersOnScreen; i++)
{
SpawnTile ();
}
}
// Update is called once per frame
private void Update () {
if (playerTransform.position.z > (spawnZ - amnCylindersOnScreen * cylinderLength))
{
SpawnTile ();
}
}
private void SpawnTile(int prefabIndex = -1)
{
GameObject go;
go = Instantiate (cylinderPrefabs [0]) as GameObject;
go.transform.SetParent (transform);
go.transform.position = Vector3.forward * spawnZ;
spawnZ += cylinderLength;
}
}
SOLUTION