Debug.Log("OnHPPropertyReady");
// Get the current value of the "hp" SyncProperty.
currentHP = syncPropertyAgent.GetPropertyWithName("hp").GetIntValue();
// Check if the local player has ownership of the GameObject.
// Source GameObject can modify the "hp" SyncProperty.
// Remote duplicates should only be able to read the "hp" SyncProperty.
int version = syncPropertyAgent.GetPropertyWithName("hp").version;
// You can check the version of a SyncProperty to see if it has been initialized.
// If version is not 0, it means the SyncProperty has been modified before.
// Probably the player got disconnected from the game.
// Set hpSlider's value to currentHP to restore player's hp.
hpSlider.value = currentHP;
// If version is 0, you can call the Modify() method on the SyncPropertyAgent to initialize player's hp to maxHp.
syncPropertyAgent.Modify("hp", maxHp);
hpSlider.value = currentHP;