概要
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 ); } } }
上記のようなエディタ拡張は動作する
非同期なので処理中も Unity エディタを操作できる