Spawn continious lines

Hi everyone,

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

What have you tried?

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

thanks

I’d recommend learning the basics first.

i already done some tutorial like : space shooter ; roll a ball ; 2D UFO & Endless 2D runner.

but still couldnt solve it on my own, what do you recommand me to learn from :slight_smile: ?

You want to use a LineRenderer and set the positions appropriately.