Skip to content

Instantly share code, notes, and snippets.

@neuecc
Created October 4, 2016 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neuecc/42aaf410e09d1a5f914fea9a74e4a2da to your computer and use it in GitHub Desktop.
Save neuecc/42aaf410e09d1a5f914fea9a74e4a2da to your computer and use it in GitHub Desktop.
for Blog #4
async Task AwaitObservable()
{
Debug.Log("start await observable");
await Observable.NextFrame(); // like yield return null
await Observable.TimerFrame(5); // await 5 frame
try
{
// ObservableWWW promote exception when await(difference in await WWW)
var result = await ObservableWWW.Get("https://404.com");
Debug.Log(result);
}
catch (WWWErrorException ex)
{
Debug.LogError(ex.ToString());
}
Debug.Log("end await observable");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment