StrixSyncFieldAttribute Class |
Namespace: SoftGear.Strix.Unity.Runtime
public class StrixSyncFieldAttribute : Attribute
The StrixSyncFieldAttribute type exposes the following members.
Name | Description | |
---|---|---|
StrixSyncFieldAttribute | Initializes a new instance of the StrixSyncFieldAttribute class |
using SoftGear.Strix.Unity.Runtime; using UnityEngine; using UnityEngine.UI; public class StrixSyncFieldExample : StrixBehaviour { [StrixSyncField] public int Health = 100; public Image HealthBar; private void OnMouseDown() { Rpc("Hit", Random.Range(3, 8)); } [StrixRpc(ProcedureCode = 1)] public void Hit(int damage) { Health = Mathf.Max(0, Health - damage); } public void Update() { HealthBar.fillAmount = Health / 100f; } }