Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Error When Using Photonnetwork.playerlist.length

Discussion in 'Scripting' started by ScribbldStudios, Apr 13, 2019.

  1. ScribbldStudios

    ScribbldStudios

    Joined:
    Apr 12, 2019
    Posts:
    1
    When I use
    PhotonNetwork.playerList.Length
    an error comes up saying 'PhotonNetwork' does not contain a definition for 'playerList'. Obviously I don't want that but I'm not sure why it is popping up. If you could help me then please do. By the way I am calling
    PhotonNetwork.playerList.Length
    in the update function if that helps and storing its value in
    public int numberPlayers
     
  2. voncarp

    voncarp

    Joined:
    Jan 3, 2012
    Posts:
    187
    Pretty sure numberPlayers = PhotonNetwork.playerList.Length should work.
     
  3. image28

    image28

    Joined:
    Jul 17, 2013
    Posts:
    457
    Check the casing of the function, If I remember correctly photon networking changed the case of some function and value names at some point during a update ( for consistency in variable names I assume ).