unity 2d how to keep spawing enemies code example
Example: spawner unity 2d
using UnityEngine;
public class Spawner : MonoBehaviour
{
public GameObject Object;
float timebtwspawn;
public float startTimeBtwSpawn;
void Update()
{
if (timebtwspawn <= 0)
{
Instantiate(Object, transform.position, Quaternion.identity);
}
else
{
timebtwspawn -= Time.deltaTime;
}
}
}