UniTask/Assets/Scenes/SandboxMain.cs

34 lines
716 B
C#
Raw Normal View History

2019-05-30 18:41:23 +08:00
using System;
using System.Collections;
2019-05-19 23:14:47 +08:00
using System.Collections.Generic;
2019-05-30 18:41:23 +08:00
using System.Threading;
2019-05-19 23:14:47 +08:00
using UniRx.Async;
using UnityEngine;
2019-05-30 18:41:23 +08:00
using UnityEngine.Networking;
using UnityEngine.UI;
2019-05-19 23:14:47 +08:00
public class SandboxMain : MonoBehaviour
{
2019-05-30 18:41:23 +08:00
public Button okButton;
public Button cancelButton;
CancellationTokenSource cts;
2019-05-19 23:14:47 +08:00
2019-05-30 18:41:23 +08:00
async void Start()
2019-05-19 23:14:47 +08:00
{
2019-05-30 18:41:23 +08:00
await UniTask.CompletedTask; // ok
// var subject = new Subject<Unit>();
//subject.OnCompleted();
IObservable<AsyncUnit> subject = default;
try
{
await subject.ToUniTask(); // exception
}
catch (Exception exception)
{
Debug.Log(exception);
}
2019-05-19 23:14:47 +08:00
}
}
2019-05-30 18:41:23 +08:00