推薦一個非常好用的 Editor Coroutines. 如果你正在做一些編輯器擴(kuò)展功能開發(fā)格仲,非運(yùn)行時環(huán)境可以運(yùn)用類似運(yùn)行時的協(xié)程等相關(guān)操作了擂红。
可以在 EditorWindow 里面執(zhí)行 所有 MonoBehavior 支持的協(xié)程,比如
StartCoroutine , StopCoroutine and StopAllCoroutines藕咏,同時也支持 WaitForSeconds and WWW等匆光。
AssetStore 地址
https://assetstore.unity.com/packages/tools/utilities/editor-coroutines-27373
github 地址:
https://github.com/marijnz/unity-editor-coroutines
if (GUILayout.Button("Start"))
{
this.StartCoroutine(Example());
}
if (GUILayout.Button("Start WWW"))
{
this.StartCoroutine(ExampleWWW());
}
if (GUILayout.Button("Start Nested"))
{
this.StartCoroutine(ExampleNested());
}
if (GUILayout.Button("Stop"))
{
this.StopCoroutine("Example");
}
if (GUILayout.Button("Stop all"))
{
this.StopAllCoroutines();
}