diff options
Diffstat (limited to 'Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/EnterPlayMode.cs')
| -rw-r--r-- | Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/EnterPlayMode.cs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/EnterPlayMode.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/EnterPlayMode.cs new file mode 100644 index 0000000..e1ad8c7 --- /dev/null +++ b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/TestRunner/Messages/EnterPlayMode.cs @@ -0,0 +1,39 @@ +using System;
+using System.Collections;
+using UnityEditor;
+
+namespace UnityEngine.TestTools
+{
+ public class EnterPlayMode : IEditModeTestYieldInstruction
+ {
+ public bool ExpectDomainReload { get; }
+ public bool ExpectedPlaymodeState { get; private set; }
+
+ public EnterPlayMode(bool expectDomainReload = true)
+ {
+ ExpectDomainReload = expectDomainReload;
+ }
+
+ public IEnumerator Perform()
+ {
+ if (EditorApplication.isPlaying)
+ {
+ throw new Exception("Editor is already in PlayMode");
+ }
+ if (EditorUtility.scriptCompilationFailed)
+ {
+ throw new Exception("Script compilation failed");
+ }
+ yield return null;
+ ExpectedPlaymodeState = true;
+
+ EditorApplication.UnlockReloadAssemblies();
+ EditorApplication.isPlaying = true;
+
+ while (!EditorApplication.isPlaying)
+ {
+ yield return null;
+ }
+ }
+ }
+}
|
