using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpawnManager : MonoBehaviour
{
public GameObject Enemy;
// Start is called before the first frame update
void Start()
{
InvokeRepeating("spawn", 0, 1);
}
// Update is called once per frame
void Update()
{
}
void spawn()
{
Instantiate(Enemy, transform.position + new Vector3(Random.Range(9,-9)0,0), Quaternion.identity);
}
},
This is the skript
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpawnManager : MonoBehaviour
{
public GameObject Enemy;
// Start is called before the first frame update
void Start()
{
InvokeRepeating("spawn", 0, 1);
}
// Update is called once per frame
void Update()
{
}
void spawn()
{
Instantiate(Enemy, transform.position + new Vector3(Random.Range(9,-9)0,0), Quaternion.identity);
}
}