Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Photon healthbar ui not updated

Discussion in 'Multiplayer' started by Censureret, Sep 13, 2021 at 7:10 PM.

  1. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    359
    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:
    2,670
    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.
     
unityunity