I am new to Unity but I do know that OnGUI is bad on mobile devices. The small game I am making with a friend requires 4 GUI objects like 2 healthbars and 2 buttons. I was wondering should I just get a texture and manipulate it through the Update function or do you guys believe that it is ok to use OnGUI for a case like this?
Neither. I’m guessing that you only need to update the healthbar when damage occurs or when the player picks up a health thing. So you don’t have to do it on everyframe.
So put the code that changes the graphic on its own function, and let the enemy or a trigger call that function when they hit/cause damage. I don’t know your general setup for causing damage.