- Home /
Question by
lamecheesykiwi · Oct 28, 2014 at 11:02 PM ·
photon
How to make a array out of my code
int players = PhotonNetwork.playerList;
string killer = new Random(0, players);
These are the lines where Unity wants an array, but I dont know how to do it. I'm new to coding and I know I'm doing something painfully obvious. Please help.
Comment
I just want to know how to make that an array. Nothing networking.
Answer by Kiwasi · Oct 28, 2014 at 11:43 PM
Does this help?
PhotonPlayer[] players = PhotonNetwork.playerList;
PhotonPlayer killer = players[Random.Range(0, players.Length)];
Taken from the exit games docs here. Should work, but I don't currently use photon.
But it should compile. Where your previous code didn't.
I have no idea about connecting to photon. But the problem is probably not in the two lines you have shown here. You might be better off discussing this with ExitGames. Its there code after all.
Your answer
