Property Changes Solutions

Yosan
Yosan
edited April 2022 in Fusion

I Work on Properties like this Example

  [Networked(OnChanged = nameof(OnHpChanged))] public float currentHp { get; set; }

  public static void OnHealthChanged(Changed<MissionCharacterStatusManager> changed)

  {

    changed.Behaviour.OnHealthChanged();

  }

  private void OnHealthChanged()

  {

    healthBar.UpdateUiBar(currentHpPoint / maxHpPoint);

  }


I Found if values have changed to 0 it will not trigger

OnChanged Function how can I solve this.

Best Answer

  • Yosan
    Yosan
    Answer ✓

    Thank you Solved . I found if I use the next update the PropertyChange of that property will be triggered

Answers

  • Hi,

    Could you explain better what you're facing?

    If a Networked property changed from, i.e : 1 to 0, on the next update the PropertyChange of that property will be triggered. But keep in mind that if it "changes" to the same value as before, it will not be called...

    The property can also change more than one time before the next update, and if the final value is the same as the inicial, the change will be missed.

    If you haven't yet gone through Fusion 100 series, take a look at: https://doc.photonengine.com/en-us/fusion/current/fusion-100/fusion-105

    --

    Isaac Augusto

    Photon Fusion Team

  • Yosan
    Yosan
    Answer ✓

    Thank you Solved . I found if I use the next update the PropertyChange of that property will be triggered