Exemplo n.º 1
0
    public RecycledGameObject NextGameObject(Transform parentTransform)
    {
        RecycledGameObject instance = null;

        foreach (var gO in poolGameObjects)
        {
            if (gO.gameObject.activeSelf != true)
            {
                instance = gO;
                instance.transform.SetParent(parentTransform);
            }
        }
        if (instance == null)
        {
            instance = CreateGameObject(parentTransform);
        }

        instance.Restart();

        return(instance);
    }
Exemplo n.º 2
0
    public RecycledGameObject NextGameObject(Vector3 position)
    {
        RecycledGameObject instance = null;

        foreach (var gO in poolGameObjects)
        {
            if (gO.gameObject.activeSelf != true)
            {
                instance = gO;
                instance.transform.position = position;
            }
        }
        if (instance == null)
        {
            instance = CreateGameObject(position);
        }

        instance.Restart();

        return(instance);
    }