12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEditor;
- using UnityEngine;
- using Object = UnityEngine.Object;
- namespace Funly.SkyStudio {
- public class EditorCoroutine
- {
- public static EditorCoroutine start(IEnumerator _routine)
- {
- EditorCoroutine coroutine = new EditorCoroutine(_routine);
- coroutine.start();
- return coroutine;
- }
- readonly IEnumerator routine;
- EditorCoroutine(IEnumerator _routine)
- {
- routine = _routine;
- }
- void start()
- {
- EditorApplication.update += update;
- }
- public void stop()
- {
- EditorApplication.update -= update;
- }
- void update()
- {
- if (!routine.MoveNext()) {
- stop();
- }
- }
- }
- }
|