ソースコード
使用例
using UniRx.Async;
using UnityEngine;
public sealed class Example : MonoBehaviour
{
private async void Start()
{
#if ENABLE_RELEASE
#else
UniTaskExt.OnStartLog += message => Debug.Log( $"{message} 開始" );
UniTaskExt.OnFinishLog += message => Debug.Log( $"{message} 終了" );
UniTaskExt.OnStartTimeLog += message => Debug.Log( $"{message} 開始" );
UniTaskExt.OnFinishTimeLog += ( message, elapsed ) => Debug.Log( $"{message} 終了 {elapsed.TotalSeconds} 秒" );
#endif
await Test1().WithLog( "Test1" );
var str1 = await Test2().WithLog( "Test2" );
await Test1().WithTimeLog( "Test1" );
var str2 = await Test2().WithTimeLog( "Test2" );
}
private static async UniTask Test1()
{
await UniTask.Delay( 1000 );
}
private static async UniTask<string> Test2()
{
await UniTask.Delay( 1000 );
return "ピカチュウ";
}
}