- Home /
Question by
ralarara_unity · Jun 16, 2018 at 05:34 PM ·
listphotonteleportplayers
[Photon] How Add players in a list when they connect
Hello, I tried to add the players to a list when they connect to be able to then change their parameters for example or to be able to teleport them separately. But I did not succeed. I would like to get your help. Thank you.
Comment
Answer by Captain_Pineapple · Jun 17, 2018 at 11:58 AM
Hey there,
what you probably want to do is to add a few lines to the start function of your player-object-scripts.
Something like:
//only add to list on server:
if (PhotonNetwork.isMasterClient) {
//find your "GameManager" or whereever you want to keep the playerObjectList and give it a function called "AddPlayerToList" which you can then pass the players transform."
GameObject.Find ("yourManagmentScriptNameGoesHere").AddPlayerToList (this.transform);
}
If this does not fulfill what you are searching for then please specify a bit more what you are trying to achive and where you are at the moment with your current code.