private void OnShipDestroyed(string name) { Inspectable inspectableShip = GameObject.Find(name).GetComponent <Inspectable>(); if (inspectableShip != null) { string containerContents = inspectableShip.GetComponent <Inspectable>().contents; if (CriticalContents == containerContents) { playerMissionEnd.FailMission("You destroyed a container with weapons"); } else { if (--containersToDestroy == 0) { playerMissionEnd.WinMission(); } } } }