How to synchronize GameObjects

First of all, sorry if I make any mistakes, it’s not my mother tongue, and if my questions is silly.
With the new network system, I tried to do a little game that goes like this :
The player connects to the server, then pick up a hero, click on a button (“Go”) and can play.

But here is my problem : the first player connected will see the second player connected’s hero while the second player won’t see the first player’s hero.
I know that the fact that the first player see the second’s player hero is due to this command (when he clicks on the “Go” button):

public GameObject champ1;
public GameObject champ2;

public void CmdChampSelected(int i)
    switch (i)
        case 1:
        case 2:

i is the number of the selected champion.

And I don’t understand why it won’t do anything if I relaunch it with the first player.

The prefab of the player spawned by the NetworkManager contains the two champions, disabled, and one of them is unable when the player click on the “Go” button after making his choice.

I’m trying to understand all the [command], [SerializedField], [ClientCallback] thing so I maybe did a huge mistake in my code, but I can’t see where.

By advance, thank you.

the state of child objects is not included in the network information for spawned objects.

You could put a SyncVar on the object to hold “championId”, then in OnStartClient active the champion on the client.

Ok, I found the solution ! Finally !

You have to use ClientRpc like that :

  1. Your command will call your ClientRpc
  2. All the actions will be executed in the Rpc

BAM ! It works ! Hope it helped you ! :slight_smile:

You will maybe have to associate that action to a key or in a Coroutine to synchronise when you want if it doesn’t work the first time.