Они расположены случайным образом, но немного далеко от коллайдера.

вот результаты:
я выбрал все порожденные объекты, чтобы показать, где они были позиционированы.

скрипт:
using System.Collections;
using UnityEngine;
public class FireEffectController : MonoBehaviour
{
public GameObject spawnableItem;
public BoxCollider area; // Assign the collider of the Fire Collider Area
// Start is called before the first frame update
void Start()
{
area = GetComponent();
Bounds colliderBounds = area.bounds;
Vector3 colliderCenter = colliderBounds.center;
float[] ranges = {
colliderCenter.x - colliderBounds.extents.x,
colliderCenter.x + colliderBounds.extents.x,
colliderCenter.y - colliderBounds.extents.y,
colliderCenter.y + colliderBounds.extents.y,
};
for (int i = 0; i < 100; i++)
{
float randomX = Random.Range(ranges[0], ranges[1]);
float randomY = Random.Range(ranges[2], ranges[3]);
Vector3 randomPos = new Vector3(randomX, randomY);
Instantiate(spawnableItem, randomPos, Quaternion.identity);
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/783 ... lider-area