How can i make GUI ammo

HI,HI,HI , HOW CAN I MAKE GUI AMMO SCRIPT THAT SHOW THE CURRENT AMMO IN GUN AND THE LEFT AMMO , AND WHEN I RELOAD ,THE AMMO LEFT IS Decrease

Plz type script

  1. Make a singleton that you will use as a GameManager so you can save all the variables about the game and you can access them everywhere in your code.
  2. Then create a new script for the whole GUI.
  3. Reference the UI you want to use for showing the ammo in the new script and in the Update function update the value taken from the singleton.
  4. So you just update the singleton variable anytime you need from everywhere in your code and the value will be shown.