//---------------------------------------------------------------------------------------------------------------
    public virtual void Push(APoolable item)
    {
#if DEBUG
        if (item == null || item.gameObject == null)
        {
            return;
        }

        if (stack.Contains(item))
        {
            Debug.LogError("Tried to pool already pooled object. Ignoring...Check for duplicate return to pool " + data.name);
            return;
        }
        if (!item.gameObject.activeSelf)
        {
            Debug.LogError("Tried to pool inactive object. Ignoring...Check for duplicate return to pool " + data.name);
            return;
        }

        if (itemsInUse.Count < 1)
        {
            Debug.LogError("Tried to pool object while pool had no items in use. Pool: " + data.name);
            return;
        }
#endif

        item.SetPooledStatus();
        item.gameObject.SetActive(false);
        stack.Push(item);
        itemsInUse.Remove(item);


        item.transform.SetParent(parent.transform);
    }
    //---------------------------------------------------------------------------------------------------------------
    void AddInstance()
    {
        APoolable item = (APoolable)MonoBehaviour.Instantiate(data.prefab, parent.transform);

        item.OnCreate();
        item.gameObject.SetActive(false);
        item.SetPooledStatus(); // Here was a bug: AddInstance and Pop do the same thing with semi-duplicated code, so AddInstance didn't set Pooled status to new Instances. TODO: Unify duplicated code.
        item.Pool = this;
        stack.Push(item);

#if UNITY_EDITOR
        item.name = data.prefab.name + stack.Count;
#endif
    }