public static void SetCrashListener(CrashListener listener) { if (CrashLoggerListenerReceiver.TryAttachReceiver()) { SetCrashLoggerListener(); } CrashLoggerListenerReceiver.SetCrashListener(listener); }
public static bool TryAttachReceiver() { if (_instance == null) { var gameObject = ToastNativePlugin.Instance.gameObject; var currentReceiver = gameObject.GetComponent <CrashLoggerListenerReceiver>(); if (currentReceiver == null) { _instance = gameObject.AddComponent <CrashLoggerListenerReceiver>(); } return(true); } return(false); }