Finding friends
Let's say your game features a friends list, and you want to know if a friend is online or offline, or perhaps even want to join your friend if they are playing in a room. Luckily Photon Cloud recently added easy support for this via the FindFriends
feature, which allows you to query the online states of a given list of users, as well the rooms the users are currently in, if any. The following example will locate and display a list of friends as defined in the inspector (in a real use case, these would likely be fetched from a database or some other source):
using UnityEngine; using System.Collections; public class Example_FindFriends : MonoBehaviour { public string[] Friends = new string[ 0 ]; void OnJoinedLobby() { // Set our player name // Note that player names are not enforced to be unique. For the most part, this is used for screen names, but is also used for the FindFriends call // You can also change the name at any time PhotonNetwork.playerName...