예제 #1
0
        public static void Recycling(GameObject gameObject, Action otherAction)
        {
            ObjectPoolAttr objectPoolAttr = gameObject.GetComponent <ObjectPoolAttr>();

            if (objectPoolAttr != null)
            {
                objectPoolAttr.sourcePool.Recycling(gameObject, otherAction);
            }
            else
            {
                UnityEngine.Object.Destroy(gameObject);
            }
        }
예제 #2
0
        private GameObject Instantiate()
        {
            GameObject     retObject = Object.Instantiate(prefab, Vector3.zero, Quaternion.identity, parent);
            ObjectPoolAttr attr      = retObject.GetComponent <ObjectPoolAttr>();

            if (attr == null)
            {
                attr = retObject.AddComponent <ObjectPoolAttr>();
            }
            attr.sourcePool = this;
            retObject.SetActive(false);
            return(retObject);
        }