title: Syncing UI Canvas to Photon Network | PunRPC
body: <p>I have an issue where I cannot sync UI Canvas information to PhotonNetwork. It syncs just fine without Photon, and I get correct information when I debug it. But if i start it with photon, it does not sync.</p>
  <p>Code below:</p>
  <pre><code>void Start()
  {
      PV = GetComponent&lt;PhotonView&gt;();
      Debug.Log(&quot;I know who is :  &quot; + PV);
  }
  
  
  
   void Update()
  {
  
      PV.RPC(&quot;DisplayHP&quot;, RpcTarget.All);
      DisplayHP();
  
      ShootTest();
      Debug.Log(&quot;Player HP : &quot; + playerHP);
  
  }
  
  
  }
  [PunRPC]
  void DisplayHP()
  {
    if(PV.IsMine)
      {
          showHP.text = playerHP.ToString();
      }      
           
  }
    
  </code></pre>
  <p>}</p>
  <p>possibly I am using it in wrong way, can someone please shed some lights what I am doing wrong in here? This is just an example from Health Canvas, other canvas also acting exactly same as health canvas.</p>
  <p>Full script below :</p>
  <pre><code>[SerializeField] float playerHP = 100f;
  [SerializeField] TextMeshProUGUI showHP;  
  [SerializeField] AudioClip audioClip;
  
  
  public int armorCheck;
  public int energyCheck;
  float energyBack = 25;
  //public PhotonView PV;
  
  
  void Start()
  {
     // PV = GetComponent&lt;PhotonView&gt;();
      
  }
  
  public void EnergyPot()
  {
      //if(PV.IsMine)
      //{
          Ammo currentAmmo = GetComponent&lt;Ammo&gt;();
          int energyCheck = GetComponent&lt;Ammo&gt;().GetCurrentAmmo(AmmoType.EnergyDrink);
  
          if (energyCheck &gt; 0)
          {
              playerHP = energyBack + playerHP;
              if (playerHP &gt;= 100)
              {
                  playerHP = 100;
                  currentAmmo.ReduceCurrentAmmo(AmmoType.EnergyDrink);
  
              }
          }
      //}                
  }
  public void TakeDamage(float damage)
  {
   //   if (PV.IsMine)
   //{ 
          Ammo currentAmmo = GetComponent&lt;Ammo&gt;();
      int armorCheck = GetComponent&lt;Ammo&gt;().GetCurrentAmmo(AmmoType.Armor);
      if (armorCheck &lt;= 0)
      {
          playerHP -= damage;
          if (playerHP &lt;= 0)
          {
              GetComponent&lt;DeathHandler&gt;().HandleDeath();
              AudioSource.PlayClipAtPoint(audioClip, Camera.main.transform.position);
              GetComponent&lt;Animator&gt;().SetTrigger(&quot;Dead_Player&quot;);
          }
      }
      else
      {
          currentAmmo.ReduceCurrentAmmo(AmmoType.Armor);
      }
    }
  //}
  //public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
  //{
  //    if(stream.IsWriting)
  //    {
  //        //DisplayHP();
  //        stream.SendNext(playerHP);
  //    }
  //    else if (stream.IsReading)
  //    {
  //        //DisplayHP();
  //        playerHP = (float)stream.ReceiveNext();
  //    }
  
  //}
  
   void Update()
  {                
      DisplayHP();
      ShootTest();        
  }
  
  void ShootTest()
  {
      if (Input.GetMouseButtonDown(0))
      {
          GetComponent&lt;Animator&gt;().SetBool(&quot;Shoot_Player&quot;, true);
          // GetComponent&lt;Animator&gt;().SetTrigger(&quot;ShootPlayer&quot;);
      }
     // GetComponent&lt;Animator&gt;().SetBool(&quot;Shoot_Player&quot;, false);
  }
  
  void DisplayHP()
  {
      //if(PV.IsMine)
      //{
          showHP.text = playerHP.ToString();            
          //Debug.Log(&quot;PV works under DisplayHP, code  :  &quot; + PV);
          Debug.Log(&quot;Player HP : &quot; + playerHP);
      //}            
               
  }
  </code></pre>
  <p>}</p>