public static void Unload(this ShipConstruct construct) { if (construct == null) { return; } for (int i = 0, count = construct.Parts.Count; i < count; i++) { Part p = construct.Parts[i]; if (p != null) { p.OnDelete(); if (p.gameObject != null) { UnityEngine.Object.Destroy(p.gameObject); } } } construct.Clear(); }