コード例 #1
0
    private IEnumerator TPObjectPoolSpawnObjects(UnityPool <GameObject> pool)
    {
        isRunning = true;
        GameObject prevObj = pool.Get();

        prevObj.transform.position = RandomSystem.InsideUnitSquare() * 5;
        while (run)
        {
            yield return(ExampleHelper.WaitSecond);

            pool.Push(prevObj);

            prevObj = pool.Get();
            prevObj.transform.position = RandomSystem.InsideUnitSquare() * 5;
            prevObj.SetActive(true);
        }
        isRunning = false;
    }