Hello,
in my setup the player gets spawned without a weapon. Immediately after spawning the player gets spawned his baseweapon. While this works for the host, it causes errors on the clients and actually i dont understand why. Most tutorials dont spawn in those items and keep them parented, they are mostly part of a prefab.
So the weapon gets spawned as a child of a child of the player and should move with the player transform.
The weapon has a Network Transform on it. I guess the problem is, that the localposition of the weapontransform stays at X: 0, Y:0, because it gets moved by the player and only gets rotated to the cursor.
The rotation is working. But its losing track of its parent, and therefor its not getting moved.
Why does the client weapons lose the parent?
Iam setting a syncvar of type Gameobject, of the current weapon on the PlayerNetworkSetter. First i call a serverRpc to change that value, and on value change i call the InstantiateNewWeaponScript on my player. The InstantiateNewWeaponScript then forwards the Gameobject to the CreateWeaponScript, which instantiates the Weapon for the Player, attaches it to his hand and spawns it on the network.
Any idea whats going wrong here?