Need help with UI.text

So, im making csgo bomb for airsoft and i need some help.

66231-pommi.png

Then i click one of the buttons UI.text appears on the screen. Then i press 1 for example and then press 2, 1 disappears. I know why but i have not been able to fix that.

var Text : UnityEngine.UI.Text;
var On = 1;

function OnMouseDown () 
	{
	if(GameObject.Find("1"));
	Text.text = "" + On;
	}

Those “” are causing old text to go away.

This happens because you set your text to “” witch is nothing + your variable.
So whatever was there before gets deleted.

What you really want is:

Text.text = Text.text + On.toString();

By using the command above you just add your new variable to the already existing text.

Good luck! :slight_smile: