以下の内容はhttps://yotiky.hatenablog.com/entry/unity_useunitasktowaitforendofaudiosourceより取得しました。


Unity - UniTaskを使ってAudioSouceの再生終了を待つ

public class AudioPlayer : MonoBehaviour
{
    public AudioSource source;

    private CancellationTokenSource cancellation;

    public async UniTask Play()
    {
        if (cancellation != null)
        {
            cancellation.Cancel();
            cancellation.Dispose();
            cancellation = null;
        }

        cancellation = new CancellationTokenSource();

        source.Play();
        Debug.Log("Play Start");

        var canceled = await UniTask.WaitWhile(() => source.isPlaying || 0 < source.time, cancellationToken: cancellation.Token).SuppressCancellationThrow();
        if (canceled)
        {
            Debug.Log("Play Canceld.");
            return;
        }

        cancellation.Dispose();
        cancellation = null;
        Debug.Log("Play Finished.");
    }
}



以上の内容はhttps://yotiky.hatenablog.com/entry/unity_useunitasktowaitforendofaudiosourceより取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14