Search Unity

Third Party [PUN]The more players the more damage?????

Discussion in 'Multiplayer' started by ExpressedUnity, Apr 25, 2018.

  1. ExpressedUnity

    ExpressedUnity

    Joined:
    Apr 19, 2015
    Posts:
    59
    Hey guys so i have a really strange one here. So im creating a multiplayer FPS with photon and it seems like the more players that are connected the more damage a single bullet is doing. Any Ideas? The following code is on the Bullet that is spawned into the server using [PunRPC]

     
  2. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    OnCollisionEnter will be called on Every client, thus applying damage multiple times.
     
    tobiass likes this.
  3. ExpressedUnity

    ExpressedUnity

    Joined:
    Apr 19, 2015
    Posts:
    59
    Ah thanks. So how can i solve this problem? Would i need to sync only when the health changes with players and not actually call the damage RPC with everyone?
     
  4. Deleted User

    Deleted User

    Guest

    In your ApplyDamage function, make sure you are only deducting the health on the local player by using photonview.ismine. Then from the same rpc you could send out another rpc which tells the other players to change your health accordingly

    -Pablo Discobar