Hey guys, I’m pretty new to Unity, but I’ve been learning pretty quick. I’m having trouble making some text appear properly,
var ammo;
var remainingammo;
var remainingfont : GUIStyle; // This font is 20px
ammo = 100;
remainingammo = ammo*1.8;
GUI.TextField(Rect(645,Screen.height-38,80,30),remainingammo,remainingfont);
The problem I’m getting is “InvalidCastException: Cannot cast from source type to destination type.”
What I’m trying to have it do is to print the number over an ammo bar, and as the ammo is used, the number goes down. What I have provided is only a fraction of the whole code, but if it’s necessary to help you solve this, I can post the whole code. Does anyone have any insight on my problem?
Thanks in advance.