docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method AddDriver

    AddDriver(NetworkDriver)

    Add a NetworkDriver instance to the MultiNetworkDriver. This driver instance must not already have any active connections, and must have the same number of pipelines as previously added instances. Drivers that are intended to take on a server role must also already be in the listening state.

    Declaration
    public int AddDriver(NetworkDriver driver)
    Parameters
    Type Name Description
    NetworkDriver driver

    NetworkDriver instance to add.

    Returns
    Type Description
    int

    An ID identifying the NetworkDriver inside the MultiNetworkDriver. This ID can be used to retrieve the driver using the GetDriver(int) method.

    Remarks

    The MultiNetworkDriver takes ownership of the NetworkDriver. While it is possible to keep operating on the NetworkDriver once it's been added, this is not recommended (at least for the operations that are already covered by the MultiNetworkDriver API).

    Exceptions
    Type Condition
    InvalidOperationException

    If the MultiNetworkDriver is at capacity (see MaxDriverCount).

    ArgumentException

    If the driver already has active connections, or if it doesn't have as many pipelines as previously added drivers. Note that this exception is only thrown when safety checks are enabled (i.e. in the editor), otherwise the driver will be added anyway.

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023