Executing command in a child GameObject in a multiplayer Game

Hello, I’m developing a 2v2 game with Unity 2017.1 and I don’t succeed to fire bullets. I have a PlayerPrefab which is an empty with a network identity component and a NetworkBehaviour script that check the inputs from the local player.
The Player prefab has a child (let’s name it Perso) which is also an empty but this time with a MonoBehaviour script that execute some methods. One of these methods is Fire which call the CmdFire command of the weapon. The weapon is a child of Perso.


Here’s the hierarchy to help you understand :
1>Player
2>Perso
3>Camera
4>Weapon
2>Car (this is the RC Car the player will be able to control. That’s why I’m putting Perso inside another empty GameObject).


So now my problem is that I don’t succeed to execute my command in the Weapon because :

There is no Network Identity on this object. Please add one.

OK. I add a NetworkIdentity on this GameObject and now “You can’t have multiple Network Identity on a single GameObject. There must be only one on the Root”. Great.

Does anyone know how to do this? Without putting all the code on the root GameObject because that would be a lot of code and I don’t think this is the clean way to do this.

Thanks per advance.

Same problem. Nobody knows how to have weapons as childs of players and having the firing handled by a script attached on the weapon?

I have exactly same problem on my project that uses Mirror Networking.
Is anybody knows how to solve this problem without changing the structure of my player?

anyone have a solution to this problem. I have the exact same problem and I don’t want to restructure and refactor everything.