Functions Reference
Godot 4 · GDScript · Setup & session
get_player_name
Returns the current player's display name (read from the local cache).
Synchronous (returns directly)
Signature
get_player_name() -> StringWhat it does
Reads the player's name cached locally from the session. No network call.
Parameters
This function takes no parameters.
How to call it
Read it any time after session_started.
Returns: String (the player's nickname).
Example
name_label.text = Gamdato.get_player_name()Use cases
- Show the player's name in a HUD or profile screen.