using System.Collections.Generic; using HurricaneVR.Framework.Weapons.Guns; using TMPro; using UnityEngine; public class WeaponCountAmmoUI : MonoBehaviour { [SerializeField] private HVRGunBase gun; [SerializeField] private List countTexts; private int cachedCount = -1; private void Update() { var count = 0; if (gun != null && gun.Ammo != null) { count = gun.Ammo.CurrentCount; } if (count != cachedCount) { cachedCount = count; foreach (var countText in countTexts) { countText.text = count.ToString(); } } } }