Version: 2019.2
LanguageEnglish
  • C#

ILocalUser.LoadFriends

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public void LoadFriends(Action<bool> callback);

Description

Fetches the friends list of the logged in user. The friends list on the Social.localUser instance is populated if this call succeeds.

using UnityEngine;
using UnityEngine.SocialPlatforms;
using System.Collections;

public class Example : MonoBehaviour { void Start() { Social.localUser.LoadFriends(success => { Debug.Log(success ? "Loaded " + Social.localUser.friends.Length + " friends" : "Loading friends failed"); }); } }