-
Notifications
You must be signed in to change notification settings - Fork 783
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e48c176
commit 55f8513
Showing
1,341 changed files
with
36,023 additions
and
36,913 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
280 changes: 140 additions & 140 deletions
280
...xtension/Editor/CoroutineWindowExample.cs → ...xtension/Editor/CoroutineWindowExample.cs
100755 → 100644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,141 +1,141 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
using UnityEditor; | ||
|
||
namespace EditorCoroutines | ||
{ | ||
public class CoroutineWindowExample : EditorWindow | ||
{ | ||
[MenuItem("Window/Coroutine Example")] | ||
public static void ShowWindow() | ||
{ | ||
EditorWindow.GetWindow(typeof(CoroutineWindowExample)); | ||
} | ||
|
||
void OnGUI() | ||
{ | ||
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(); | ||
} | ||
|
||
if (GUILayout.Button("Also")) | ||
{ | ||
this.StopAllCoroutines(); | ||
} | ||
|
||
if (GUILayout.Button("WaitUntil/WaitWhile")) | ||
{ | ||
status = false; | ||
this.StartCoroutine(ExampleWaitUntilWhile()); | ||
} | ||
|
||
if (GUILayout.Button("Switch For WaitUntil/WaitWhile:" + (status ? "On" : "Off"))) | ||
{ | ||
status = !status; | ||
EditorUtility.SetDirty(this); | ||
} | ||
} | ||
|
||
private bool status; | ||
|
||
IEnumerator ExampleWaitUntilWhile() | ||
{ | ||
yield return new WaitUntil(()=>status); | ||
Debug.Log("Switch On"); | ||
yield return new WaitWhile(()=>status); | ||
Debug.Log("Switch Off"); | ||
} | ||
|
||
IEnumerator Example() | ||
{ | ||
while (true) | ||
{ | ||
Debug.Log("Hello EditorCoroutine!"); | ||
yield return new WaitForSeconds(2f); | ||
} | ||
} | ||
|
||
IEnumerator ExampleWWW() | ||
{ | ||
while (true) | ||
{ | ||
var www = new WWW("https://unity3d.com/"); | ||
yield return www; | ||
Debug.Log("Hello EditorCoroutine!" + www.text); | ||
yield return new WaitForSeconds(2f); | ||
} | ||
} | ||
|
||
IEnumerator ExampleNested() | ||
{ | ||
while (true) | ||
{ | ||
yield return new WaitForSeconds(2f); | ||
Debug.Log("I'm not nested"); | ||
yield return this.StartCoroutine(ExampleNestedOneLayer()); | ||
} | ||
} | ||
|
||
IEnumerator ExampleNestedOneLayer() | ||
{ | ||
yield return new WaitForSeconds(2f); | ||
Debug.Log("I'm one layer nested"); | ||
yield return this.StartCoroutine(ExampleNestedTwoLayers()); | ||
} | ||
|
||
IEnumerator ExampleNestedTwoLayers() | ||
{ | ||
yield return new WaitForSeconds(2f); | ||
Debug.Log("I'm two layers nested"); | ||
} | ||
|
||
|
||
class NonEditorClass | ||
{ | ||
public void DoSomething(bool start, bool stop, bool stopAll) | ||
{ | ||
if (start) | ||
{ | ||
EditorCoroutines.StartCoroutine(Example(), this); | ||
} | ||
if (stop) | ||
{ | ||
EditorCoroutines.StopCoroutine("Example", this); | ||
} | ||
if (stopAll) | ||
{ | ||
EditorCoroutines.StopAllCoroutines(this); | ||
} | ||
} | ||
|
||
IEnumerator Example() | ||
{ | ||
while (true) | ||
{ | ||
Debug.Log("Hello EditorCoroutine!"); | ||
yield return new WaitForSeconds(2f); | ||
} | ||
} | ||
} | ||
} | ||
using UnityEngine; | ||
using System.Collections; | ||
using UnityEditor; | ||
|
||
namespace EditorCoroutines | ||
{ | ||
public class CoroutineWindowExample : EditorWindow | ||
{ | ||
[MenuItem("Window/Coroutine Example")] | ||
public static void ShowWindow() | ||
{ | ||
EditorWindow.GetWindow(typeof(CoroutineWindowExample)); | ||
} | ||
|
||
void OnGUI() | ||
{ | ||
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(); | ||
} | ||
|
||
if (GUILayout.Button("Also")) | ||
{ | ||
this.StopAllCoroutines(); | ||
} | ||
|
||
if (GUILayout.Button("WaitUntil/WaitWhile")) | ||
{ | ||
status = false; | ||
this.StartCoroutine(ExampleWaitUntilWhile()); | ||
} | ||
|
||
if (GUILayout.Button("Switch For WaitUntil/WaitWhile:" + (status ? "On" : "Off"))) | ||
{ | ||
status = !status; | ||
EditorUtility.SetDirty(this); | ||
} | ||
} | ||
|
||
private bool status; | ||
|
||
IEnumerator ExampleWaitUntilWhile() | ||
{ | ||
yield return new WaitUntil(()=>status); | ||
Debug.Log("Switch On"); | ||
yield return new WaitWhile(()=>status); | ||
Debug.Log("Switch Off"); | ||
} | ||
|
||
IEnumerator Example() | ||
{ | ||
while (true) | ||
{ | ||
Debug.Log("Hello EditorCoroutine!"); | ||
yield return new WaitForSeconds(2f); | ||
} | ||
} | ||
|
||
IEnumerator ExampleWWW() | ||
{ | ||
while (true) | ||
{ | ||
var www = new WWW("https://unity3d.com/"); | ||
yield return www; | ||
Debug.Log("Hello EditorCoroutine!" + www.text); | ||
yield return new WaitForSeconds(2f); | ||
} | ||
} | ||
|
||
IEnumerator ExampleNested() | ||
{ | ||
while (true) | ||
{ | ||
yield return new WaitForSeconds(2f); | ||
Debug.Log("I'm not nested"); | ||
yield return this.StartCoroutine(ExampleNestedOneLayer()); | ||
} | ||
} | ||
|
||
IEnumerator ExampleNestedOneLayer() | ||
{ | ||
yield return new WaitForSeconds(2f); | ||
Debug.Log("I'm one layer nested"); | ||
yield return this.StartCoroutine(ExampleNestedTwoLayers()); | ||
} | ||
|
||
IEnumerator ExampleNestedTwoLayers() | ||
{ | ||
yield return new WaitForSeconds(2f); | ||
Debug.Log("I'm two layers nested"); | ||
} | ||
|
||
|
||
class NonEditorClass | ||
{ | ||
public void DoSomething(bool start, bool stop, bool stopAll) | ||
{ | ||
if (start) | ||
{ | ||
EditorCoroutines.StartCoroutine(Example(), this); | ||
} | ||
if (stop) | ||
{ | ||
EditorCoroutines.StopCoroutine("Example", this); | ||
} | ||
if (stopAll) | ||
{ | ||
EditorCoroutines.StopAllCoroutines(this); | ||
} | ||
} | ||
|
||
IEnumerator Example() | ||
{ | ||
while (true) | ||
{ | ||
Debug.Log("Hello EditorCoroutine!"); | ||
yield return new WaitForSeconds(2f); | ||
} | ||
} | ||
} | ||
} | ||
} |
File renamed without changes.
74 changes: 37 additions & 37 deletions
74
...nsion/Editor/EditorCoroutineExtensions.cs → ...nsion/Editor/EditorCoroutineExtensions.cs
100755 → 100644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
using System.Collections; | ||
using UnityEditor; | ||
|
||
namespace EditorCoroutines | ||
{ | ||
public static class EditorCoroutineExtensions | ||
{ | ||
public static EditorCoroutines.EditorCoroutine StartCoroutine(this EditorWindow thisRef, IEnumerator coroutine) | ||
{ | ||
return EditorCoroutines.StartCoroutine(coroutine, thisRef); | ||
} | ||
|
||
public static EditorCoroutines.EditorCoroutine StartCoroutine(this EditorWindow thisRef, string methodName) | ||
{ | ||
return EditorCoroutines.StartCoroutine(methodName, thisRef); | ||
} | ||
|
||
public static EditorCoroutines.EditorCoroutine StartCoroutine(this EditorWindow thisRef, string methodName, object value) | ||
{ | ||
return EditorCoroutines.StartCoroutine(methodName, value, thisRef); | ||
} | ||
|
||
public static void StopCoroutine(this EditorWindow thisRef, IEnumerator coroutine) | ||
{ | ||
EditorCoroutines.StopCoroutine(coroutine, thisRef); | ||
} | ||
|
||
public static void StopCoroutine(this EditorWindow thisRef, string methodName) | ||
{ | ||
EditorCoroutines.StopCoroutine(methodName, thisRef); | ||
} | ||
|
||
public static void StopAllCoroutines(this EditorWindow thisRef) | ||
{ | ||
EditorCoroutines.StopAllCoroutines(thisRef); | ||
} | ||
} | ||
using System.Collections; | ||
using UnityEditor; | ||
|
||
namespace EditorCoroutines | ||
{ | ||
public static class EditorCoroutineExtensions | ||
{ | ||
public static EditorCoroutines.EditorCoroutine StartCoroutine(this EditorWindow thisRef, IEnumerator coroutine) | ||
{ | ||
return EditorCoroutines.StartCoroutine(coroutine, thisRef); | ||
} | ||
|
||
public static EditorCoroutines.EditorCoroutine StartCoroutine(this EditorWindow thisRef, string methodName) | ||
{ | ||
return EditorCoroutines.StartCoroutine(methodName, thisRef); | ||
} | ||
|
||
public static EditorCoroutines.EditorCoroutine StartCoroutine(this EditorWindow thisRef, string methodName, object value) | ||
{ | ||
return EditorCoroutines.StartCoroutine(methodName, value, thisRef); | ||
} | ||
|
||
public static void StopCoroutine(this EditorWindow thisRef, IEnumerator coroutine) | ||
{ | ||
EditorCoroutines.StopCoroutine(coroutine, thisRef); | ||
} | ||
|
||
public static void StopCoroutine(this EditorWindow thisRef, string methodName) | ||
{ | ||
EditorCoroutines.StopCoroutine(methodName, thisRef); | ||
} | ||
|
||
public static void StopAllCoroutines(this EditorWindow thisRef) | ||
{ | ||
EditorCoroutines.StopAllCoroutines(thisRef); | ||
} | ||
} | ||
} |
File renamed without changes.
Oops, something went wrong.