docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class AllocationUtils

    Utility methods for relay allocations

    Inheritance
    object
    AllocationUtils
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.Services.Relay.Models
    Assembly: Unity.Services.Multiplayer.dll
    Syntax
    public static class AllocationUtils

    Methods

    ToRelayServerData(Allocation, string)

    Convert an allocation to Transport's Unity.Networking.Transport.Relay.RelayServerData model.

    Declaration
    public static RelayServerData ToRelayServerData(this Allocation allocation, string connectionType)
    Parameters
    Type Name Description
    Allocation allocation

    Allocation from which to create the server data.

    string connectionType

    Type of connection to use ("udp", "dtls", "ws" or "wss").

    Returns
    Type Description
    RelayServerData

    Relay server data model for Transport.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if allocation is null, if the connection type is invalid or if no endpoint match the connection type.

    ToRelayServerData(Allocation, RelayProtocol)

    Convert an allocation to Transport's Unity.Networking.Transport.Relay.RelayServerData model.

    Declaration
    public static RelayServerData ToRelayServerData(this Allocation allocation, RelayProtocol connectionType)
    Parameters
    Type Name Description
    Allocation allocation

    Allocation from which to create the server data.

    RelayProtocol connectionType

    Type of connection to use (UDP, DTLS, WS or WSS).

    Returns
    Type Description
    RelayServerData

    Relay server data model for Transport.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if allocation is null, if the connection type is invalid or if no endpoint match the connection type.

    ToRelayServerData(JoinAllocation, string)

    Convert an allocation to Transport's Unity.Networking.Transport.Relay.RelayServerData model.

    Declaration
    public static RelayServerData ToRelayServerData(this JoinAllocation allocation, string connectionType)
    Parameters
    Type Name Description
    JoinAllocation allocation

    Allocation from which to create the server data.

    string connectionType

    Type of connection to use ("udp", "dtls", "ws" or "wss").

    Returns
    Type Description
    RelayServerData

    Relay server data model for Transport.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if allocation is null, if the connection type is invalid or if no endpoint match the connection type.

    ToRelayServerData(JoinAllocation, RelayProtocol)

    Convert an allocation to Transport's Unity.Networking.Transport.Relay.RelayServerData model.

    Declaration
    public static RelayServerData ToRelayServerData(this JoinAllocation allocation, RelayProtocol connectionType)
    Parameters
    Type Name Description
    JoinAllocation allocation

    Allocation from which to create the server data.

    RelayProtocol connectionType

    Type of connection to use (UDP, DTLS, WS or WSS).

    Returns
    Type Description
    RelayServerData

    Relay server data model for Transport.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if allocation is null, if the connection type is invalid or if no endpoint match the connection type.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)