Untitled

 avatar
unknown
plain_text
a year ago
639 B
8
Indexable
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);
    }
}
Editor is loading...
Leave a Comment