Untitled
unknown
plain_text
2 years ago
639 B
12
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