forked from modesttree/Unity3dAsyncAwaitUtil
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add edit-time support to AsyncCoroutineRunner
If the package com.unity.editorcoroutine is installed, AsyncCoroutineRunner gains the ability to work at edit time. In Unity 2019.1 and above, no additional setup is needed. Otherwise, the symbol HAVE_EDITOR_COROUTINES must also be manually defined. Includes unit test. Addresses part of modesttree#9
- Loading branch information
Showing
6 changed files
with
118 additions
and
6 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
UnityProject/Assets/Plugins/AsyncAwaitUtil/Source/AsyncAwaitUtil.asmdef
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "AsyncAwaitUtil", | ||
"references": [ | ||
"GUID:478a2357cc57436488a56e564b08d223" | ||
], | ||
"includePlatforms": [], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [ | ||
{ | ||
"name": "com.unity.editorcoroutines", | ||
"expression": "0.0.2-preview", | ||
"define": "HAVE_EDITOR_COROUTINES" | ||
} | ||
] | ||
} |
7 changes: 7 additions & 0 deletions
7
UnityProject/Assets/Plugins/AsyncAwaitUtil/Source/AsyncAwaitUtil.asmdef.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
UnityProject/Assets/Plugins/AsyncAwaitUtil/Tests/Editor/TestMisc.cs
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
|
||
using NUnit.Framework; | ||
using UnityEngine; | ||
using UnityEngine.TestTools; | ||
|
||
namespace UnityAsyncAwaitUtil | ||
{ | ||
class TestMisc | ||
{ | ||
[UnityTest] | ||
public IEnumerator TestAsyncCoroutineRunnerInEditor() | ||
{ | ||
List<bool> result = new List<bool>(); | ||
AsyncCoroutineRunner.Instance.StartCoroutine(AppendCoroutine(result)); | ||
for (int i = 0; i < 10; ++i) | ||
{ | ||
if (result.Count > 0) { yield break; } | ||
yield return null; | ||
} | ||
Assert.Fail("Coroutine did not complete"); | ||
} | ||
|
||
static IEnumerator AppendCoroutine(List<bool> result) | ||
{ | ||
yield return null; | ||
result.Add(true); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
UnityProject/Assets/Plugins/AsyncAwaitUtil/Tests/Editor/TestMisc.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.