Function call during remote player connected to game

Options
Currently in my game project when a remote player gets connected it shows up as XXX(Clone) in my game scene, I would like to change the GameObject Name from XXX(Clone) to RemoteUserName.

I have tried using OnPlayerEnteredRoom() but this is only called when the remote user connects to the room (first scene to enter name). I am looking for a function that is called when the remote user enters the game scene(second scene which is called after the login scene). I even tried using OnPhotonInstantiate() function but it is not called when the second scene that is the actual scene is loaded.

Comments

  • S_Oliver
    S_Oliver ✭✭✭
    edited April 2020
    Options
    Since you creating your player object at some point and the Instantiate call returns the created object just rename it there.
    var playerObject = PhotonNetwork.Instantiate(objtToSpawn,spawnPosition,spawnRotation, 0);
    playerObject.name = "xxx";