I’m making a game and i have a script where when i kill the enemy he splits into 4 more enemies but I don’t know how to make them spawn around the enemy. they all spawn on the enemies position.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Enemy : MonoBehaviour
{
// public
public GameObject smallSplitter;
// private
GameObject enemy;
// void
void Update()
{
enemy = GameObject.FindGameObjectWithTag("Enemy");
}
void OnCollisionEnter2D(Collision2D other)
{
if (other.collider.tag == "Player")
{
Destroy(enemy.gameObject);
Instantiate(smallSplitter, transform.position, transform.rotation);
Instantiate(smallSplitter, transform.position, transform.rotation);
}
}
}