以下の内容はhttps://baba-s.hatenablog.com/entry/2020/03/26/090000より取得しました。


【Unity】エディタ拡張で async / await を使用する

概要

using System.Threading.Tasks;
using UnityEditor;
using UnityEngine;

public class Example
{
    [MenuItem( "Tools/Run" )]
    private static void Run()
    {
        RunAsync();
    }

    private static async void RunAsync()
    {
        var count = 10;

        for ( int i = 0; i < count; i++ )
        {
            var num = i + 1;

            Debug.Log( $"{num}/{count}" );

            await Task.Delay( 1000 );
        }
    }
}

上記のようなエディタ拡張は動作する

f:id:baba_s:20200325232219g:plain

非同期なので処理中も Unity エディタを操作できる




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

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