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); } }
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); }