Class EditorWindowCoroutineExtension
Inheritance
Inherited Members
Namespace: Unity.EditorCoroutines.Editor
Syntax
public static class EditorWindowCoroutineExtension
Methods
StartCoroutine(EditorWindow, IEnumerator)
Start an EditorCoroutine, owned by the calling
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 | |
System.Collections.IEnumerator | routine |
Returns
Type | Description |
---|---|
EditorCoroutine |
StopCoroutine(EditorWindow, EditorCoroutine)
Immediately stop an EditorCoroutine that was started by the calling
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
Type | Name | Description |
---|---|---|
EditorWindow | window | |
EditorCoroutine | coroutine |