public static void ReturnGun(GunObject gunObj) { IEnumerator WaitForBulletsToReturn() { Debug.Log("Waiting For Bullets to Return before Returning"); Debug.Log("All Bullets have Returned"); Transform gun = ShootingController.currentGun.transform; gun.GetComponent <GunObject>().ammoPool.ReturnAllBullets(); while (gunObj.ammoPool.transform.childCount != gunObj.ammoPool.allBullets.Count) // while gunObj doesn't have all bullets { instance.CreatePickup(gunObj.gameObject); yield return(null); } gunObj.clipSize = gunObj.maxClipSize; gun.SetParent(GunManager.instance.transform); gun.gameObject.SetActive(false); instance.CreatePickup(gunObj.gameObject); yield return(null); } instance.StartCoroutine(WaitForBulletsToReturn()); }