using System.Diagnostics; using System.Reflection; using NitroxModel.Helper; using UnityEngine; namespace NitroxPatcher.Patches.Persistent; /// /// Ensures is set to true at all times. /// /// /// Nitrox needs to be running updates and processing packets at all times to work properly. /// public sealed partial class Application_runInBackground_Patch : NitroxPatch, IPersistentPatch { public static readonly MethodInfo TARGET_METHOD = Reflect.Property(() => Application.runInBackground).GetSetMethod(); public static bool Prefix(bool value) { if (!value) { Log.WarnOnce($"An attempt to set {nameof(Application.runInBackground)} to \"false\" was issued but it was ignored.\n{new StackTrace()}"); Application.runInBackground = true; return false; } return true; } }