using UnityEngine; using System.Collections; public class ChallengeRequestsCounter : MonoBehaviour { public UILabel notificationCount; void Awake() { MessageCenter.AddReceivedRequestsListener(OnReceivedRequests); FacebookHelper.AddLogoutListener(OnLogout); } void OnDestroy() { MessageCenter.RemoveReceivedRequestsListener(OnReceivedRequests); FacebookHelper.RemoveLogoutListener(OnLogout); } void OnReceivedRequests(ReceivedRequestsArgs requests) { int challengeRequests = requests.challengeRequests.Count; if (challengeRequests > 0) { notificationCount.text = challengeRequests.ToString(); } else { notificationCount.text = ""; } } void OnLogout() { notificationCount.text = ""; } }