private IEnumerator PerformMyTopRecord() { // Show our loading indicator. StartLoading(); // Get the enumerator that fetches the top record for this user. var enumerator = CurrLeaderboard.MyTopRecord(); // We will be just waiting until the enumerator is done. This means that // we are in the loading state. while (enumerator.MoveNext()) { yield return(null); } // We are finished, stop the loading. StopLoading(); // Fetches the response. var value = (Leaderboards.MyTopRecordResponsePayload)enumerator.Current; if (value.IsError) { // An error occurred. We need to handle that. Items.DisplayItems(new List <string> { "An error occurred. Please try again." }); yield break; } if (value.HasFinished) { Items.DisplayItems(new List <string> { string.Format("You've finished this level in place={0} value={1}", value.Record.Place, value.Record.Value) }); } else { Items.DisplayItems(new List <string> { string.Format("You have not finished this level") }); } }