Untitled

mail@pastecode.io avatar
unknown
plain_text
22 days ago
639 B
5
Indexable
Never
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

public class enemySpawner2 : MonoBehaviour
{
    public float moveSpeed;
    public GameObject enemy2;
    public float enemyNumberToSpawn;

    void Start()
    {
        for (int i = 0; i < enemyNumberToSpawn; i++)
        {
            SpawnEnemy();
        }
    }

    void Update()
    {
        
    }

    private void SpawnEnemy()
    {
        Vector2 spawnPosition = new Vector2(Random.Range(-5f, 5f), Random.Range(-5f, 5f));
        Instantiate(enemy2, spawnPosition, Quaternion.identity);
    }
}
Leave a Comment