I'm not sure I asked my question properly. Let me explain my problem in a little bit more detail.
When a new player joins, I want them to send everybody else their username. Right now, I have this:
// Enable and disable player components based on whether they are *my* player, or the networked player clones
void setupNetworkedPlayer() {
// If this is my player...
if(tno.isMine) {
// Add username
mPlayerName = TNManager.playerName;
// Tell everybody else to add my name to my clones in their game
tno.Send(2,Target.OthersSaved, TNManager.player, mPlayerName);
// Enable player controls
instance.GetComponent<SimpleMove>().enabled = true;
// Enable camera and audio
instance.transform.FindChild("Camera").gameObject.SetActive(true);
// Enable mouselook on capsule
instance.GetComponent<MouseLook>().enabled = true;
}
}
// This is where I'm having issues
[RFC(2)]
void setJoinedPlayerName(Player p, string name) {
// Find player p's gameObject, and set the mPlayerName variable in this script to the passed name
mPlayerName = name;
}
In the RFC, I'm not sure how to connect the Player p to the cloned game object player on everybody else's clients.
Another option in my mind would have the each TNPlayer "own" a list of TNObjects. Thus, as player1 I could find all objects belonging to player2, player3, etc. Though I don't want to go hack up your scripts because I'd imagine theres a better way.