- Home /
Question by
CadenGS_ · Jun 03, 2018 at 09:59 PM ·
c#textuser interfaceinputfieldunity 4
If i have a script how to I input an int from there to a text UI?
I'm making an FPS, how do i make my currentAmmo int print in a text, the same way javascript goes console.log(currentAmmo + " / 30")
Comment
Best Answer
Answer by b1gry4n · Jun 03, 2018 at 10:25 PM
if you want it on UI, you need to make a UIText component on a canvas. https://docs.unity3d.com/Manual/script-Text.html https://docs.unity3d.com/Manual/UICanvas.html
using UnityEngine.UI;
public Text display;
int someValue;
void Update()
{
display.text = someValue.ToString();
}
if youre not talking about ui... Debug.Log(currentAmmo + "/30");