Hi I want to create a game like temple run, but really simple I want to have L shaped and T shaped platforms, I have looked at many tutorials but I have failed to create something. I want the platforms (the shapes) to come at random but I want everything to link together. Could some one please tell me, what I would have to do with the code to make it so that the platforms are generating one after the other and not at random positions on the screen. Thank you.
public class SpawnScript : MonoBehaviour {
public GameObject[] obj;
public float spawnMinimum = 2f;
public float spawnMaximum = 4f;
// Use this for initialization
void Start () {
Spawn ();
}
// Update is called once per frame
void Spawn() {
Instantiate (obj [Random.Range (0, obj.GetLength (0))], transform.position, Quaternion.identity);
Invoke ("Spawn", Random.Range (spawnMinimum, spawnMaximum));
}
}