- Home /
(c#) Photon networking, get players in room?
Hello!
I'm trying to display the players in the current room to a text object (4.6 ui). This is what I've tried, however the output is "PhotonPlayer[]"...
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class NetworkTextdisplay : MonoBehaviour {
public text playerListText;
void OnJoinedRoom() {
playerListText.text = (PhotonNetwork.otherPlayers.ToString());
}
}
Comment
Answer by Bluk · Jul 05, 2015 at 02:43 PM
PhotonPlayer[] otherList = PhotonNetwork.otherPlayers;
String s = "";
foreach (PhotonPlayer player in otherList) {
s += player.ToString();
}
playerListText.text = s;
Your answer
Follow this Question
Related Questions
Move gameobject to button in new 4.6? 0 Answers
Unity 4.6 Beta Controller Menu Button Movement 0 Answers
Unity 4.6 - Rotating with Mouse Issue 0 Answers
Converting UI RectTransform to Screen Pixel and vice-versa 5 Answers
4.6 combo/dropdown box 2 Answers