using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DecalSpawner : MonoBehaviour
{
    public GameObject[] decalPrefabs;
    public Rect spawnZone;
    public int amount = 200;

    private void Awake()
    {
        SpawnDecals();
    }

    [ExecuteInEditMode]
    public void SpawnDecals()
    {
        for (int i = 0; i < amount; i++)
        {
            var instance = Instantiate(decalPrefabs[Random.Range(0, decalPrefabs.Length)], new Vector3(Random.Range(spawnZone.xMin, spawnZone.xMax), 0.1f, Random.Range(spawnZone.yMin, spawnZone.yMax)), Quaternion.Euler(90f, 0f, 0f));
            instance.transform.parent = transform;
        }
    }
}
