Skip to content

GodotSteamKit Tutorials - Usernames

By Gramps


This tutorial will cover the basics of using the Steam Username custom nodes from the GodotSteamKit.

Usage

Once you have the GodotSteamKit installed, there will be two new label nodes: SteamUsername and SteamUsername3D which are the Label2D and Label3D nodes, respectively.

You can set the user's Steam ID directly to the steam_id property or use its setter method, set_steam_id:

# Assigning the property directly

steam_username.steam_id = new_steam_id

# Alternatively setting the steam_id property by using the setter function

steam_username.set_steam_id(new_steam_id)

Once the Steam ID is set, the node will call getFriendPersonaName() and display the user's current Steam username. If the local player does not have this name cached, the node will then call requestUserInformation() to get it and then display it once persona_state_change is triggered.

Any time the player updates their username in Steam, , this node should receive a persona_state_change callback and then request and update the visible username to match.

Properties

steam_id

The Steam ID associated with this username. Used to retrieve the current username and check the persona callbacks.

Functions

set_steam_id

This is the setter function for steam_id which will set the Steam ID to track and automatically requests the current username.

Troubleshooting

If no username is displayed at any point, check to see if your callbacks are enabled. You may also want to print the node's steam_id property to make sure it is what you are expecting:

print("Steam Username set as: %s" % steam_username.steam_id)