im a new unity user, im creating my first 2D game and im stuck now, im using C# and i want to make a script to spawn continious lines with random lenght (like in the game Break Liner…somthing like in the picture), and i dont know how, i searched in tutorials & manual but didnt found somthing similar.
Thanks for your quick response for now i started spawning diffrent prefabs (lines) within a periode of time using this script :
using UnityEngine;
using System.Collections;
public class SpanScript : MonoBehaviour {
public GameObject[ ] obj;
public float spawnMin = 1f;
public float spawnMax = 2f;
// Use this for initialization
void Start () {
Spawny();
}
// Update is called once per frame
void Spawny() {
Instantiate(obj[Random.Range(0, obj.GetLength(0))], transform.position, Quaternion.identity);
Invoke(“Spawny”, Random.Range(spawnMin, spawnMax));
}
}
its a script that i found in a tutorial but it is basically used to spawn obstacles or collectables, and its not what i wanted