- Home /
Question by
FrreStuff · Feb 22, 2014 at 07:14 PM ·
script errorendless runner
Endless rendering doesnt work
so i saw a video on how to make a endless runner game and i gave it a try. Everything went perfect untill i made a prefab that i had to place ,and what the prefab is supposed to do is make a random and endless running path. Instead it only makes a path on that position where that prefab is placed. This is my script :
using UnityEngine; using System.Collections;
public class SpawnScript : MonoBehaviour {
public GameObject[] obj;
public float spawnMin = 1f;
public float spawnMax = 2f;
// Use this for initialization
void Start () {
Spawn();
}
void Spawn ()
{
Instantiate(obj[Random.Range (0, obj.GetLength(0))], transform.position, Quaternion.identity);
Invoke ("Spawn", Random.Range (spawnMin, spawnMax));
}
}
This is a link to the video : he is making the script and prefab at 34:30 minutes
I hope someone can help me and understand what i mean ,i know i didnt explain it really good that's because my English isn't that good.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613134356im_/https://answers.unity.com/themes/thub/images/avi.jpg)