blob: 85ef8897912e2f5946b78a8e64a4a5ff9ad3264d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
using System;
using System.Collections;
using UnityEditor;
namespace UnityEngine.TestTools
{
public class ExitPlayMode : IEditModeTestYieldInstruction
{
public bool ExpectDomainReload { get; }
public bool ExpectedPlaymodeState { get; private set; }
public ExitPlayMode()
{
ExpectDomainReload = false;
ExpectedPlaymodeState = false;
}
public IEnumerator Perform()
{
if (!EditorApplication.isPlayingOrWillChangePlaymode)
{
throw new Exception("Editor is already in EditMode");
}
EditorApplication.isPlaying = false;
while (EditorApplication.isPlaying)
{
yield return null;
}
}
}
}
|