Files

24 lines
579 B
C#

using System;
using System.Threading;
using UnityEngine;
public static class Util
{
/// 특정 시간(초) 후에 액션을 실행
public static async Awaitable RunDelayed(float delay, Action action, CancellationToken token = default)
{
try
{
// 유니티 전용 비동기 대기
await Awaitable.WaitForSecondsAsync(delay, token);
// 함수 실행
action?.Invoke();
}
catch (OperationCanceledException)
{
// 취소되었을 때의 처리 (필요 시)
}
}
}