Code Snippits

These are minimal examples to help you get started utilizing Steamworks.NET. They should provide a strong base on which you can build upon.


How do I get the players display name?

string name = SteamFriends.GetPersonaName();

How do I loop through the list of friends and get their name and status?

int friendCount = SteamFriends.GetFriendCount(EFriendFlags.k_EFriendFlagImmediate);
Debug.Log("[STEAM-FRIENDS] Listing " + friendCount + " Friends.");
for (int i = 0; i < friendCount; ++i) {
	CSteamID friendSteamId = SteamFriends.GetFriendByIndex(i, EFriendFlags.k_EFriendFlagImmediate);
	string friendName = SteamFriends.GetFriendPersonaName(friendSteamId);
	EPersonaState friendState = SteamFriends.GetFriendPersonaState(friendSteamId);

	Debug.Log(friendName + " is " + friendState);


How do I get the players unique SteamID?

CSteamID steamId = SteamUser.GetSteamID();