sync variables

Options
I want all the variables for the player to be synced on all clients so the client can click on any player and see their stats. I thought this would be as simple as syncing them all when the player is first instantiated.

void Start () {
photonView.RPC("SetAll", PhotonTargets.All);
}

[PunRPC]
void SetAll () {
gameObject.name = gameObject.name;
variables = variables;
}

It doesn't work, i can click on the enemies in the inspector and none of their variables have any values. The name isn't synced properly either, i have a UI element that displays the name of the gameobject you've clicked. How do i sync all variables on the gameObject across all players? These same gameobjects have their transform synced properly.

Comments