error with Unity Viking demo
Options
Hi guys i have an issue and need some help,
I have put in the ap id and was successful and i have been following the pdf document for the Viking demo and i have opened the Viking demo scene but when i hit play i get the following error and dont know how to fix it:
MarcoPolo-Tutorial - PhotonPlayer[] does not contain a definition for 'Count' and no extension method 'Count' of type 'PhotonPlayer[]' could be found (are you missing a using directive or an assembly reference?)
I dont know where to start is it that i should have another using declared at the top of the gamlogic.cs this is what i have and this is what line it is referencing when i get the above error
using UnityEngine;
using System.Collections;
void OnJoinedRoom()
{
// game logic: if this is the only player, we're "it"
if (PhotonNetwork.playerList.Count == 1) // THIS IS WHERE THE ERROR IS
any help i would appreciate it
Kind regards
I have put in the ap id and was successful and i have been following the pdf document for the Viking demo and i have opened the Viking demo scene but when i hit play i get the following error and dont know how to fix it:
MarcoPolo-Tutorial - PhotonPlayer[] does not contain a definition for 'Count' and no extension method 'Count' of type 'PhotonPlayer[]' could be found (are you missing a using directive or an assembly reference?)
I dont know where to start is it that i should have another using declared at the top of the gamlogic.cs this is what i have and this is what line it is referencing when i get the above error
using UnityEngine;
using System.Collections;
void OnJoinedRoom()
{
// game logic: if this is the only player, we're "it"
if (PhotonNetwork.playerList.Count == 1) // THIS IS WHERE THE ERROR IS
any help i would appreciate it
Kind regards
0
Comments
-
ok guys going through the guide and changed the line to this
Player IDs
Photon uses a player “ID” or “playerNumber” to mark each of the players in a room. It’s an integer, which makes it relatively small in terms of data. As it’s not re-assigned ever, we can “talk” about players in a room by their ID.
The ID of our local client is stored in PhotonNetwork.player.ID. If we’re alone, we’ll save this into “playerWhoIsIt”, a static field which is easy to access it in different scripts.
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
public static int playerWhoIsIt;.
.
void OnJoinedRoom().
{.
// game logic: if this is the only player, we're "it".
if (PhotonNetwork.playerList.Length == 1) // changed to this instead
{.
playerWhoIsIt = PhotonNetwork.player.ID;.
}.
.
Debug.Log("playerWhoIsIt: " + playerWhoIsIt);0