1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using UnityEngine;
using Cysharp.Threading.Tasks;
using System;
 
public static class UniTaskExtension
{
    public static void DelayFrame(this GameObject go, Action action)
    {
        DelayFrameInternal(action);
    }
 
    public static void DelayFrame(this Component cmp, Action action)
    {
        DelayFrameInternal(action);
    }
 
    private async static UniTask DelayFrameInternal(Action action)
    {
        await UniTask.DelayFrame(1);
        action?.Invoke();
    }
}