Social.LoadUsers

Hi,

Does anyone have an example of how to use Social.LoadUsers? The documentation is a little lacking and I can’t seem to wrap my head around it :slight_smile:

http://docs.unity3d.com/Documentation/ScriptReference/Social.LoadUsers.html

My goal is to extract usernames and scores from a leaderboard, but I’ve only been able to find examples of how to get usernames from the local user’s friends like this:

for (int i=0; i < Social.localUser.friends.Length; i++)
{
	if (score.userID == Social.localUser.friends[i].id)
	{
		curUserName = Social.localUser.friends[i].userName;	
	}						
}

So, I need a way to get usernames for those userIDs who are not friends of the local user. Any help?

No one knows how to use Social.LoadUsers? That’s unfortunate :sad:

Hey there, in order to use Social.LoadUsers you would do something like this ( I am sure you solved this by now, but in case others are still curious :slight_smile:

void LoadLeaderboardUsers(string[ ] userIDs)
{
Debug.Log(“There was " + userIDs.Length + " user ids”);
if(authenticated)
{
Social.LoadUsers(userIDs, OnLeaderboardUsersLoaded);
}
}

void OnLeaderboardUsersLoaded(IUserProfile[ ] profiles)
{
Debug.Log(“There was " + profiles.Length + " profiles loaded”);
foreach(IUserProfile profile in profiles)
{
Debug.Log("PROFILE NAME = " + profile.userName);
}
}

will crashed at Social.LoadUsers(userIDs, OnLeaderboardUsersLoaded);