FPS gun not syncing

Options
Hello peoples! I was having a bit of issue with regards to PUN2. Hopefully some of you coding wizards can help out :D. So anyway, so far I've got my FPS player moving and shooting. I also have the player's transform and rotation synced, so clients in the same room can see each other move around :D. Great right? Well the only problem is that my gun model doesn't seem to be visible to other clients. Each client can only see their own gun. My game only has one gun in it and is equipped from the start. Any ideas guys? I can provide images of my code and hierachy on request. Tenks in advance!

Comments

  • sierra
    Options
    Pics to help describe my problem are below. I have set the Gun GameObject to false. I use an RPC fucntion to set this GameObject to true across all clients including the host, so everyone should see the gun become active. However, this isn't the case. When I run the game inside Unity and on a separate build, each client has the boolean isEquipped set to true, and each client can see their own gun. However they can't see each other's gun.

    https://ibb.co/5jfWytk

    https://ibb.co/FB5Cjcm

    https://ibb.co/6bBVcvM
  • sierra
    Options
    I've managed to get it working :) I had to place the gun parent as a direct child of the Player root object (the gameobject right at the top of the hierarchy), instead of the camera object. I also had to place the weapon equip script on the Player root object because it had a photonView component on it.

    But I do have a question though - is it possible to make a gun the child of the FPS camera and get other players to see it?
  • sierra
    Options
    Update - it isn't possible^. Make the gun a child of the player object and then equip it using an RPC function, not PhotonNetwork.Instantiate().