- Home /
convert old gui to new
More specifically , a snippet of code I use to show a battery for a flashlight. It works perfectly how it is, however it uses the old GUI system and I want to keep everything updated. It is
//Display current battery on your flashlight
function OnGUI () {
GUI.Label (Rect(70, Screen.height/rectHeight - 75,150,60), "Battery: " + energy.ToString("F0") + "%");
}
So how would I make this into the new ui ? Sorry im more of a edit code kinda person, I understand it but I have no idea what ANY of the new ui is code wis .
Answer by $$anonymous$$ · Feb 05, 2015 at 05:34 PM
take a look at Text component http://docs.unity3d.com/Manual/script-Text.html
Here is a good explanation video : http://unity3d.com/learn/tutorials/modules/beginner/ui/ui-text
Thank you , I haven't really gotten to explore the new ui much. From what I see its very close to ngui so I enjoy that.
Yes it seems that way. But new UI (ugui) has a lot more cool stuff in it.