/// <summary> /// Try to perform an Action on game thread, if it fails do not crash the game. /// </summary> public static void TryInvokeOnGameThread(this IMyUtilities util, Action invoke, Logger logTo = null) { util.InvokeOnGameThread(() => { try { invoke.Invoke(); } catch (Exception ex) { if (logTo != null) logTo.alwaysLog("Exception: " + ex, Logger.severity.ERROR); else (new Logger("MiscExtensions")).alwaysLog("Exception: " + ex, Logger.severity.ERROR); } }); }