I am making a simple simulator game where there are three buttons and a text field but when I added the GUI the frame rate slowed to a crawl is there a way to make this thing without using the OnGUI function which I have read seems to slow it down
function OnGUI ()
{
temp = playerBase.GetComponent("Base");
GUI.Box (Rect (150,40,250,50), "Resources = " + temp.supplies + "\n Base HP = " + temp.baseHp);
if(warningOn)
{
GUI.Box (Rect (200,200,500,30), "Not Enough Resources");
if (timer)
{
counter--;
if (counter < 0)
{
timer = false;
}
}
else
{
counter = 300;
timer = true;
warningOn = false;
}
}
if (GUI.Button (Rect (20,40,80,20), "Ball 1 50"))
{
temp.make1();
}
if (GUI.Button (Rect (20,70,80,20), "Ball 2 100"))
{
temp.make2();
}
if (GUI.Button (Rect (20,100,80,20), "Ball 3 200"))
{
temp.make3();
}
}