Hello I have a gun switching system with gun data on each specific gun, i want to have the current amount of ammo and the mag size as text at the side, but it can only use it from gun data on a specific gun, is there anyway to switch it or something else?
the current score system
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class GunAmmoText : MonoBehaviour
{
[SerializeField] TextMeshProUGUI Ammo_Text;
[SerializeField] GunData GunData ;
void Update()
{
Ammo_Text.text = GunData.currentAmmo + "/" + GunData.magSize;
}
}
the gun data script which you kinda fill out
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "Gun" , menuName = "Weapon/Gun")]
public class GunData : ScriptableObject
{
[Header("Info")]
public new string name;
[Header("Shooting")]
public float damage;
public float MaxDistance;
[Header("Reloading")]
public int currentAmmo;
public int magSize;
public float fireRate;
public float reloadTime;
[HideInInspector]
public bool reloading;
}