Ive been asking this questions on exit games forums and all they’ve given me is the code below which works, but I can’t use get component on the string TaggedPlayer. Do you know how to enabled and disable code on TaggedPlayer?
public List<string> PlayerList = new List<string>();
void OnPhotonPlayerConnected(){
if (!PlayerList.Contains (PhotonNetwork.playerName)) {
PlayerList.Add (PhotonNetwork.playerName);
}
}
//This code is messy I'm paste this on my tablet because I'm away right now.
void TagRandomPlayer(){
int PlayerListRange = PlayerList.Count;
System.Random Rand = new System.Random ();
int RandomPick = Rand.Next (0, PlayerListRange);
string TaggedPlayer = PlayerList [RandomPick];
}