It gives me number : 330 instead of 30 .I have no clue what causing that.
Rest of script is good because it after first shoot(LMB) start counting down as it should be : 29,28,27…
Picture of before shooting:
import UnityEngine.UI;
public var Ammo : int = 30;
var UiTextGameO : GameObject;
var UiTextAmmo : UI.Text;
function Start (){
UiTextAmmo = UiTextGameO.GetComponent(UI.Text);
}
function update (){
var curAmmo = Ammo;
var TScurAmmo = Ammo.ToString("Bullets:"+Ammo);
UiTextAmmo.text = TScurAmmo;
}