PhotonTarget : OthersBuffered PROBLEM...

hi all, i hope anyone can help me as soon as p;

i have problem to sync a value like health float,
in case i have a tower and player can attack the tower.
the problems (Networking):
player1 join and attack tower until tower health as 90percent, and then…player2 join too, and have actually same tower as 90percent health,
but…while player2 attack tower until 60percent health’stower, the player1 side, the tower not changes about same tower health.

im using this code :

public class healthTower : Photon.MonoBehaviour
{

PhotonView pv;
public float currentHP;

void Start ()
   {
      pv = GetComponent<PhotonView> ();
      pv.viewID = 1;
      if(pv.isMine) this.enabled = false;
   }

void OnPhotonSerializeView (PhotonStream stream, PhotonMessageInfo info)
   {
      if(stream.isWriting){
         float curHealth = currentHP;
         stream.Serialize(ref curHealth);
      }else   {
         float cHealth = 0;
         stream.Serialize(ref cHealth);}
   }

[RPC]public void ModifTower (float amountHP)
   {
      this.currentHP += amountHP;
      if(pv.isMine) pv.RPC("ModifTower", PhotonTargets.OthersBuffered, amountHP);
   }

void TestInput ()
   {
      if(Input.GetKeyDown(KeyCode.A))
         ModifTower(-1);
   }

void Update()
   {
      TestInput();
   }
}

Question : whats wrong in my code, what can i do to get best sync values?

notes :
tower not instantiate, i input viewId as manual;
player instantiate by network, viwId by runtime;

The way you do it, you never call the networked RPC (pv.RPC(“…”)) if the tower is not yours.

yeah…the tower is not mine,
hmm…
can you give me any sample based my code? pls

i was lose some time for this problem, im get stressed…

btw…i get code that worked
thanks @tobiass
i just found words as “The InstantiateSceneObject feature is relatively new…”
at http://forum.exitgames.com/viewtopic.php?f=17&t=1844
im using it and recode my own like :

[RPC]public void ModifTower (float damage)
    {
        this.currentHP += damage;
        this.currentHP = this.currentHP < 1 ? 0 : this.currentHP > maxHP ? maxHP : this.currentHP;

        if(!photonView.isMine){
            pv.RPC("ModifTower", PhotonTargets.OthersBuffered, damage);}
    }

......

void UpdateCurrent ()
    {
        if(!PhotonNetwork.isMasterClient)
            this.currentHP = this.receiveHP;
    }

The point of my reply was: You want to call the RPC method on all clients - including the local one. It informs everyone about the damage, right? It gets sent by whoever hit that turret in your case. So you don’t have to check “isMine”.

Try something along these lines:

void TestInput ()
{
  if(Input.GetKeyDown(KeyCode.A))
     towerWhichIsHitPhotonView.RPC("ModifTower", PhotonTargets.All, -1);
}

Don’t call RPC() in the method that has [RPC] in that case.

hi @tobiass , vry thanks for response.
u right about “Don’t call RPC() in the method that has [RPC] in that case.” im get it as solution as worked.
honestly im develope an moba game like LoL, i know i just a newbie about unity networking and i see photon is better than standard networking of unity.
i have any instant to test (i was send it to my testers)
i save them in Dropbox - Error - Simplify your life (using photon cloud as asia server)
is a peer to peer networking? im using PUN free to test, and ive plan to purchase pun+.
cos testers said that any problem in network

PUN+ does not improve the network connections. It just uses a different way on Android and iOS to access the sockets of the device. Aside from that, communication-wise it’s the same as PUN Free. Of course, you also get a 100 CCU Photon Cloud subscription for a one-time fee, which is not entirely bad.
PUN is not peer to peer.