I have been doing an inventory system lately I have been using the GUILayout
functions for soo long time but after knowing that it does harm the performance if it is used extensively so, I switch to the good old normal GUI
functions.
Now I have come across a function known as GUIStyle.CalcSize();
so, I began using it and was wondering does it harm the performance if used let’s say 25 times per frame?
Thanks in advance!
Anything that is done without actually needing is something you would like to avoid, because even if it’s not eating a lot from your frame computation times, they tend to pile up. So later you will have optimization problems, and most probably low performance on low devices.
I propose you to do something like this:
// any change of the text or the image in the content variable should flag this as true
if (contentChanged)
{
Vector2 size = GUIStyle.CalcSize(content)
// do something with the received size
}
I hope this helps (i know i’m a bit late with this info)