Class WaitForDomainReload
WaitForDomainReload is an IEditModeTestYieldInstruction that you can yield in Edit Mode tests. It delays the execution of scripts until after an incoming domain reload. If the domain reload results in a script compilation failure, then it throws an exception.
Implements
Inherited Members
Namespace: UnityEngine.TestTools
Assembly: UnityEditor.TestRunner.dll
Syntax
public class WaitForDomainReload : IEditModeTestYieldInstruction
Constructors
WaitForDomainReload()
Create a new instance of the WaitForDomainReload
yield instruction.
[UnitySetUp]
public IEnumerator SetUp()
{
File.Copy("Resources/MyDll.dll", @"Assets/MyDll.dll", true); // Trigger a domain reload.
AssetDatabase.Refresh();
yield return new WaitForDomainReload();
}
Declaration
public WaitForDomainReload()
Properties
ExpectDomainReload
Returns true if the instruction expects a domain reload to occur.
Declaration
public bool ExpectDomainReload { get; }
Property Value
Type | Description |
---|---|
bool |
ExpectedPlaymodeState
Returns true if the instruction expects the Unity Editor to be in Play Mode.
Declaration
public bool ExpectedPlaymodeState { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
Perform()
Perform the multi step action of waiting for a domain reload.
Declaration
public IEnumerator Perform()
Returns
Type | Description |
---|---|
IEnumerator | An IEnumerator with steps. |
Exceptions
Type | Condition |
---|---|
Exception | Throws an exception if script compilation failed or if the expected domain reload did not occur. |