Class RelayCodes
- Namespace
- Unity.Multiplayer.Core
Maps Unity Relay's own join codes to JoinCodes and back. Relay codes are 6 to 12 characters from Alphabet, every one of which is in Alphabet, so a Relay code is used as the join code's data and gains the check character: players get the same typo-tolerant format whichever service minted the code.
public static class RelayCodes
- Inheritance
-
RelayCodes
- Inherited Members
Fields
Alphabet
The characters Unity Relay writes its join codes in (its documentation's restricted set).
public const string Alphabet = "6789BCDFGHJKLMNPQRTW"
Field Value
MaxLength
Longest Relay join code.
public const int MaxLength = 12
Field Value
MinLength
Shortest Relay join code.
public const int MinLength = 6
Field Value
Methods
ToJoinCode(string)
The join code players type for Relay code relayJoinCode (case and separators ignored).
public static JoinCode ToJoinCode(string relayJoinCode)
Parameters
relayJoinCodestring
Returns
Exceptions
- NotSupportedException
The Relay code is not 6-12 characters of Alphabet.
TryGetRelayCode(JoinCode, out string)
The Relay code inside code, when its data could be one (6-12 characters of
Alphabet). A rendezvous code can look Relay-shaped by chance, so a true result means "worth
asking Relay", not "certainly Relay".
public static bool TryGetRelayCode(JoinCode code, out string relayJoinCode)