guiText disappears on input

The guiText displays the start value until I provide any input - mouse or keyboard. I’m new to Unity and GUI in general and am stumped. Here’s the script:

using UnityEngine;
using System.Collections;

public class AmmoCounter : MonoBehaviour{
	
	public static string ammoCount;
	public GUIText myGUIText;
		
	void Start() {
		
		myGUIText.text = "20 / 20";
	}
	
	void Update(){
			
		myGUIText.text = ammoCount;
	}
				
		
}

ammoCount is updated by another class with “AmmoCounter.ammoCount = ;”

Thank you!

I’d bet good money that the value in ammoCount is being set to an empty string by the other class.

Try replacing

myGUIText.text = ammoCount;

with

if (ammoCount!=null && ammoCount!="")
{myGUIText.text = ammoCount;}
else
{myGUIText.text = "ammoCountVariable was set to empty";}