static IEnumerator WaitAndMakeLonePart(Part newPart, OnPartReady onPartReady) { Debug.Log("[ModuleMissileRearm]: Create lone part vessel for {0}" + newPart); string originatingVesselName = newPart.vessel.vesselName; newPart.physicalSignificance = Part.PhysicalSignificance.NONE; newPart.PromoteToPhysicalPart(); newPart.Unpack(); newPart.disconnect(true); Vessel newVessel = newPart.gameObject.AddComponent <Vessel>(); newVessel.id = Guid.NewGuid(); if (newVessel.Initialize(false)) { newVessel.vesselName = Vessel.AutoRename(newVessel, originatingVesselName); newVessel.IgnoreGForces(10); newVessel.currentStage = StageManager.RecalculateVesselStaging(newVessel); newPart.setParent(null); } yield return(new WaitWhile(() => !newPart.started && newPart.State != PartStates.DEAD)); Debug.Log("[ModuleMissileRearm]: Part {0} is in state {1}" + newPart + newPart.State); if (newPart.State == PartStates.DEAD) { Debug.Log("[ModuleMissileRearm]: Part {0} has died before fully instantiating" + newPart); yield break; } if (onPartReady != null) { onPartReady(newPart); } }