UniTask v2 – Unity

Unity
GitHub - Cysharp/UniTask: Provides an efficient allocation free async/await integration for Unity.
Provides an efficient allocation free async/await integration for Unity. - GitHub - Cysharp/UniTask: Provides an efficient allocation free async/await integrati...

非同期など

Releases · Cysharp/UniTask
Provides an efficient allocation free async/await integration for Unity. - Cysharp/UniTask

から  UniTask.2.2.5.unitypackage をダウンロードしてUnityに追加

Assets/Plugins/UniTask

Cysharp.Threading.Tasksで利用

using UnityEngine;
using Unity.Netcode;
using Cysharp.Threading.Tasks;

public class VsManager : MonoBehaviour
{
    int playerNo = 0;

    async void SetMessaging()
    {
        await UniTask.WaitUntil(() => NetworkManager.Singleton.IsListening);
        // isListeningになるまで待ってから
    }
}

コメント

タイトルとURLをコピーしました