c# coroutines

4 replies [Last post]
Yorick's picture
Joined: Mar 21 2010
Posts:

Using the DimeRocker API in c# requires a lot of coroutines. I'm starting to get the hang of them and I feel the Post Score example could be improved. It says:

StartCoroutine( drClient.leaderboard.PostScore( leaderboardId, localUser.GetId(), newScore, new ArrayList(), 0, 0 ) );
// Wait for PostScore to complete before fetching the record
yield return new WaitForSeconds(2);

Now just waiting 2 seconds is unreliable. Isn't it far easier and more reliable to use:

yield return StartCoroutine( drClient.leaderboard.PostScore( leaderboardId, localUser.GetId(), newScore, new ArrayList(), 0, 0 ) );

Tempest's picture
Joined: Nov 7 2009
Posts:
Yes, thanks for catching

Yes, thanks for catching that. That was an line from an older script which I'm embarrassed to used. I'll update the example.

Yorick's picture
Joined: Mar 21 2010
Posts:
your welcome. Byt the way,

your welcome. By the way, should I use the forum for feedback or PM or email?

Tempest's picture
Joined: Nov 7 2009
Posts:
Feel free to use any of those

Feel free to use any of those methods.

Geko's picture
Joined: Sep 27 2009
Posts:
Using the forum is good

Using the forum is good because we are trying to kick some life into it. That said don't hesitate to email us if you need something.