Class EditorWindowCoroutineExtension
Inheritance
EditorWindowCoroutineExtension
Syntax
public static class EditorWindowCoroutineExtension
Methods
StartCoroutine(EditorWindow, IEnumerator)
Start an EditorCoroutine, owned by the calling EditorWindow instance.
using System.Collections;
using Unity.EditorCoroutines.Editor;
using UnityEditor;
public class ExampleWindow : EditorWindow
{
void OnEnable()
{
this.StartCoroutine(CloseWindowDelayed());
}
IEnumerator CloseWindowDelayed() //close the window after 1000 frames have elapsed
{
int count = 1000;
while (count > 0)
{
yield return null;
}
Close();
}
}
Declaration
public static EditorCoroutine StartCoroutine(this EditorWindow window, IEnumerator routine)
Parameters
Type |
Name |
Description |
EditorWindow |
window |
|
IEnumerator |
routine |
|
Returns
StopCoroutine(EditorWindow, EditorCoroutine)
Immediately stop an EditorCoroutine that was started by the calling instance. This method is safe to call on an already completed EditorCoroutine.
using System.Collections;
using Unity.EditorCoroutines.Editor;
using UnityEditor;
using UnityEngine;
public class ExampleWindow : EditorWindow
{
EditorCoroutine coroutine;
void OnEnable()
{
coroutine = this.StartCoroutine(CloseWindowDelayed());
}
private void OnDisable()
{
this.StopCoroutine(coroutine);
}
IEnumerator CloseWindowDelayed()
{
while (true)
{
Debug.Log("Running");
yield return null;
}
}
}
Declaration
public static void StopCoroutine(this EditorWindow window, EditorCoroutine coroutine)
Parameters