Class PlayerNames

Namespace
Unity.Multiplayer.Core

The rules for a player's display name (UM-T55), engine-free so dotnet test covers them. The server checks a rename against Validate(string) and refuses it with the reason; a name that arrives in a connection approval payload is Clean(string, string)ed into the roster instead, so an old client never fails to join over its name.

public static class PlayerNames
Inheritance
PlayerNames
Inherited Members

Remarks

Allowed: letters and digits in any script, combining marks, punctuation and symbols (emoji included), and single ASCII spaces between words. Refused: control and invisible formatting characters (zero-width joiners, direction overrides), private-use and unassigned code points, broken surrogate pairs, other kinds of blank space, line breaks, two spaces in a row, a leading or trailing space, and more than MaxLength characters.

Fields

MaxLength

The longest name, in UTF-16 characters (the approval payload's limit).

public const int MaxLength = 32

Field Value

int

Methods

Clean(string, string)

name made acceptable: characters Validate(string) refuses dropped, any run of blank space made one space, trimmed, cut to MaxLength, and fallback when nothing is left.

public static string Clean(string name, string fallback = "Player")

Parameters

name string
fallback string

Returns

string

IsValid(string)

True when name passes Validate(string).

public static bool IsValid(string name)

Parameters

name string

Returns

bool

Validate(string)

Why name is not an acceptable display name, or null when it is.

public static string Validate(string name)

Parameters

name string

Returns

string