private static void OnAutopilotAttached(MySyncShipController syncObject, ref AttachAutopilotMsg message, MyNetworkClient sender) { var cockpit = syncObject.m_shipController as MyCockpit; Debug.Assert(cockpit != null, "Trying to assing autopilot to something else than cockpit!"); if (cockpit != null) { (syncObject.m_shipController as MyCockpit).AttachAutopilot(MyAutopilotFactory.CreateAutopilot(message.Autopilot)); } }