Skip to main content

PlayerProxy

A class in Root.Township, Alta.QuickAccessActions.

A networked, saved stand-in for a player (a dummy with a name, title and member status) that the Show Names action labels like a real player. The server syncs its fields to clients.

Constructors​

MemberWhat it is
PlayerProxy()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

5 private and internal fields
MemberWhat it is
private Transform headBacking field for Head.
private PlayerSubscriberStatus statusBacking field for Status.
private MethodSync syncMethod sync for the name, title and status message.
private string titleBacking field for Title.
private string userNameBacking field for UserName.

Properties​

MemberWhat it is
Transform Head { get; }Transform the name board is placed above.
static HashSet<PlayerProxy> PlayerProxies { get; }Every live proxy. Read by Show Names each frame to place name boards.
PlayerSubscriberStatus Status { get; }Member status shown on the proxy's shield.
string Title { get; }Title text for the proxy. Saved and synced.
string UserName { get; }Name shown for the proxy. Saved and synced.

Methods​

MemberWhat it is
override void Initialize()Creates the SyncNameProxy method sync used to send the name, title and status.
override void OnConnected(Player player)Sends the name, title and status to a player who just connected.
3 private and internal methods
MemberWhat it is
private void Awake()Adds the proxy to PlayerProxies.
private void OnDestroy()Removes the proxy from PlayerProxies.
private void Sync(IPlayer player, Stream stream)Serializes user name, title and status. Remote clients apply the received status.

Used in​

Members of other types that take, return or hold a PlayerProxy: