errors when upgraded photon 2 (help please!)

Options
hello so i made another script but i updated photon voice 2 because i needed to update and now
PhotonNetwork.LocalPlayer.UserId
is getting an error which is
error CS0200: Property or indexer 'Player.UserId' cannot be assigned to -- it is read only

Comments

  • Federico123
    edited April 2020
    Options
    before i didnt upgrade i didnt get this error :(
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @Federico123,

    You can't set UserId or change it after connecting.
    Set UserId through PhotonNetwork.UserId before connecting.
    Otherwise here is how to set UserId in general.
  • Federico123
    Options
    JohnTube wrote: »
    Hi @Federico123,

    You can't set UserId or change it after connecting.
    Set UserId through PhotonNetwork.UserId before connecting.
    Otherwise here is how to set UserId in general.

    Sorry but i forgot one thing.
    It's on
    void LoggedIn(string userName, string userId)
    
  • Federico123
    Options
    also @JohnTube it worked before i updated but it still in pun 2, i just updated pun 2 because it had a update and that happened, and if i remove
    PhotonNetwork.LocalPlayer.UserId
    
    it will always stay disconnected.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @Frederico123,

    In PUN Classic, PhotonPlayer.UserId setter is internal.
    void LoggedIn(string userName, string userId)
    
    Not sure where this is from as it's not Photon code.
    if i remove
    PhotonNetwork.LocalPlayer.UserId
    it will always stay disconnected.
    Remove from where, how do you connect? do you mean client can't connect or client get disconnected?