Anyone experience PUN2 sending multiple rpc

My game uses Photon for almost 2 years successfully.

Im trying to update my game now. and I updated the Pun2 in assetstore.

But It cause me bug. Im using unity 2019.4 and the latest PUN2 in asset store.

First when player and enemy collide the deduction of life is okay means normal.

but on the second game When I tried to invite my opponent. and have a fight.

when they CLASH the minus of life became multiple its like its being called twice.

I never edited any on my multiplayer codes so its must have been the update.

THIS IS WHAT I OBSERVE:

-if i invite my opponenent for the first time -"NO BUGS"

-if i invite my opponent for the second time - HAS BUGS ( multiple calls on minus life)

-if my opponent invited me to have a fight. - the bug is gone, and its ok.

THE BUG OCCURS WHEN I FIGHT MY OPPONENT MULTIPLE TIMES, and Im the one who invites him, but when he invites me the bug disappeared.

I tried to use some of RPC clear cache but nothing works:

PhotonNetwork.OpCleanActorRpcBuffer (int actorNumber)
PhotonNetwork.CleanRpcBufferIfMine (PhotonView view)
PhotonNetwork.OpCleanRpcBuffer (PhotonView view)

for cached events in general:

PhotonNetwork.OpRemoveCompleteCacheOfPlayer (int actorNumber)
PhotonNetwork.OpRemoveCompleteCache()


PLEASE HELP ME IM STUCK FOR A WEEK :(

Comments

  • SOLVED:

    Spent 6 days to figure it out what a headache.

    The bug is when you create a room, and you invite 1 friend to play with you 1 on 1 photonview.ismine of player 1 will set to true and other player photonview.ismine will set to false

    BUT WHEN YOU invite him again, creating a new room, and invite the same player. both of your photonview.ismine will be true!!!

    So that one is causing the bug! because both players are sending damage, instead of just 1 which is in my condition of if ( photonview.isMine == true ) { send damage }

    But weird thing is when your opponent invite you the bug photonview.ismine will disapear even you play with each other multiple times.

    SOLUTION:

    I send the other player via photonChat who created the room,

    I created a variable named: I_CREATE_THE_ROOM.

    whoever creates the room will be true and the other player will be false.

    So I can successfully send the damage in a single way