Skip to main content

PlayerText

A class in Root.Township, Alta.Character.

A UI text above a player that follows their body and turns to face the local player's head (or the scene camera in the editor).

Constructors​

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

Fields​

2 private and internal fields
MemberWhat it is
private PlayerCharacter playerThe player this text belongs to.
private Text textThe UI Text component.

Properties​

MemberWhat it is
string Text { get; set; }The shown text. Setting null or empty hides it.

Methods​

5 private and internal methods
MemberWhat it is
private void DeleteIfLocalPlayer(PlayerController player)Destroys the text if the given player is the one it belongs to. Nothing in this class subscribes it.
private void FaceSceneViewCamera()In the editor, turns to face the current camera.
private void FaceTransform(Transform transform)Turns to look at the given transform.
private void Start()Finds the PlayerCharacter it belongs to.
private void Update()While shown, moves over the player's body and faces the local player's head.