コガネブログ

平日更新を目標に Unity や C#、Visual Studio、ReSharper などのゲーム開発アレコレを書いていきます

【Unity】DOTween で async / await を使用する

ソースコード

使用例

using DG.Tweening;
using UnityEngine;

public class Example : MonoBehaviour
{
    private async void Start()
    {
        var t = transform;

        await t.DOMove( Random.onUnitSphere, 1 );           // 移動
        await t.DORotate( Random.rotation.eulerAngles, 1 ); // 回転
        await t.DOScale( Random.insideUnitSphere, 1 );      // 拡縮
        await DOTween.To( value => { }, 0, 1, 1 );
    }
}

f:id:baba_s:20180506135014g:plain

TweenExt.cs を Unity プロジェクトに導入することで
DOTween で async / await を使用できるようになります