using UnityEngine;

public class CubePrefabSpawner : MonoBehaviour
{
    // We serialize the CubePrefabObjectPool field so we can see it in the editor which allows
    // us to drag and drop the object pool reference in the editor
    [SerializeField] private ObjectPool cubePrefabObjectPool;

    private void Start()
    {
        InvokeRepeating("SpawnCubePrefab", 1, 0.25f);
    }

    private void SpawnCubePrefab()
    {
        cubePrefabObjectPool.Instantiate(Random.insideUnitSphere, Random.rotation);
    }
}
