In short, I’m making a simple 2D space shooter game. For the ship, I have a basic ammo counter. It doesn’t have anything complex on it yet. Just the code stating how much ammo the player has. However, I get the warning mentioned above and I cant find out why.
//Reference to the text mesh for the Ammo count.
public TextMesh ammoTextMesh;
//Contains a copy of the original text to be later
//modified for a dynamic value.
private string AmmoText;
// Use this for initialization
void Start () {
updateAmmo (10);
}
public void updateAmmo (int value) {
ammoTextMesh.text = AmmoText;
ammoTextMesh.text += value;
}
This is all there is to it right now, and it mimics the exact same code I have for player health, yet the health isnt throwing a code. I do also have an ammo text gameObject, which I ensured MANY times was attached to the HUD script being used above.