docs.unity.cn
    Show / Hide Table of Contents

    Class EnterPlayMode

    Implements IEditModeTestYieldInstruction. Creates a yield instruction to enter Play Mode.

    Inheritance
    Object
    EnterPlayMode
    Namespace: UnityEngine.TestTools
    Syntax
    public class EnterPlayMode : IEditModeTestYieldInstruction

    Constructors

    EnterPlayMode(Boolean)

    When creating an Editor test that uses the UnityTest attribute, use this to trigger the Editor to enter Play Mode. Throws an exception if the Editor is already in Play Mode or if there is a script compilation error.

    Declaration
    public EnterPlayMode(bool expectDomainReload = true)
    Parameters
    Type Name Description
    Boolean expectDomainReload

    A flag indication whether to expect a domain reload.

    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()

    Performs the multi-step instructions of entering PlayMode.

    Declaration
    public IEnumerator Perform()
    Returns
    Type Description
    IEnumerator

    An IEnumerator with the async steps.

    Implements
    IEditModeTestYieldInstruction.Perform()
    Exceptions
    Type Condition
    Exception

    An exception is thrown if the editor is already in PlayMode or if script compilation failed.

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