ソースコード
using System;
using System.Threading;
namespace UniRx.Async
{
public partial struct UniTask
{
public static UniTask DelaySecond
(
float seconds,
bool ignoreTimeScale = false,
PlayerLoopTiming delayTiming = PlayerLoopTiming.Update,
CancellationToken cancellationToken = default( CancellationToken )
)
{
return Delay
(
TimeSpan.FromMilliseconds( seconds ),
ignoreTimeScale,
delayTiming
);
}
}
}
使用例
Before
using System;
using UniRx.Async;
using UnityEngine;
public sealed class Example : MonoBehaviour
{
private async void Start()
{
await UniTask.Delay( TimeSpan.FromSeconds( 1 ) );
}
}
After
using UniRx.Async;
using UnityEngine;
public sealed class Example : MonoBehaviour
{
private async void Start()
{
await UniTask.DelaySecond( 1 );
}
}