Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Third Party Photon healthbar ui not updated

Discussion in 'Multiplayer' started by Censureret, Sep 13, 2021.

  1. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    363
    I have an NPC who is placed in the scene (not instantiated)

    upload_2021-9-13_20-9-51.png

    Then i have the following script:

    Code (CSharp):
    1.        
    2. private void Update()
    3.         {
    4.             if (photonView.IsMine)
    5.             {
    6.                 _hitRatio = CurrentHitPoint / MaxHitPoint;
    7.                 CurrentHitPointImage.rectTransform.localScale = new Vector3(_hitRatio, 1, 1);
    8.                
    9.             }
    10.         }
    11.  
    However it is not updating the scale can anyone tell me what i might be missing?
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    In this case, everyone should see the scaling, not just the client which controls the character.
    So the "IsMine" condition is not what you want in this case.