void OnDisable() { if (sInstance == this) { sInstance = null; } }
/// <summary> /// Creates a gameobject for use with UnitySendMessage from native side. /// Must be called from Unity game thread. /// </summary> internal static AndroidNotificationListener GetListener() { if (sInstance == null) { var go = new GameObject(ANDROID_NOTIFICATION_LISTENER_GAMEOBJECT); go.hideFlags = HideFlags.HideAndDontSave; sInstance = go.AddComponent <AndroidNotificationListener>(); DontDestroyOnLoad(go); } return(sInstance); }