Ejemplo n.º 1
0
    public void Destroy()
    {
        ObjectPoolRef r = this.GetComponent <ObjectPoolRef>();

        if (r != null)
        {
            r.Pool.Unspawn(this.gameObject);
        }
        else
        {
            Destroy(this.gameObject);
        }
    }
Ejemplo n.º 2
0
    void CreateObject()
    {
        Object o = GameObject.Instantiate(Obj);

        SetToParent(o);
        Available.Add(o);
        GameObject g = o as GameObject;

        if (g != null)
        {
            ObjectPoolRef r = g.GetComponent <ObjectPoolRef>();
            if (r == null)
            {
                r      = g.AddComponent <ObjectPoolRef>();
                r.Pool = this;
            }
        }
    }