docs.unity.cn
    Show / Hide Table of Contents

    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.

    Inheritance
    Object
    WaitForDomainReload
    Namespace: UnityEngine.TestTools
    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
    Boolean
    Implements
    IEditModeTestYieldInstruction.ExpectDomainReload

    ExpectedPlaymodeState

    Returns true if the instruction expects the Unity Editor to be in Play Mode.

    Declaration
    public bool ExpectedPlaymodeState { get; }
    Property Value
    Type Description
    Boolean
    Implements
    IEditModeTestYieldInstruction.ExpectedPlaymodeState

    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.

    Implements
    IEditModeTestYieldInstruction.Perform()
    Exceptions
    Type Condition
    Exception

    Throws an exception if script compilation failed or if the expected domain reload did not occur.

    Back to top Copyright © 2022 Unity Technologies
    Generated by DocFX
    on Tuesday, July 19, 2022
    Terms of use