- Home /
OnGUI() Resources
I was wondering if there is a way to see how much resources are being used to process the OnGUI() methods? For example how many milliseconds it takes to execute all of the OnGUI() methods together, and also how many times it gets called per frame. I know I can make this with a simple counter variable in a script ut I was wondering if Unity had anything built in?
Well there's the profiler in Unity PRO - but that is allegedly inaccurate when it comes to OnGUI calls (it records the editors OnGUI stuff too).
Also your own counter won't take in to consideration the setup/$$anonymous$$r down time for an OnGUI call, but it will give you the nmber of calls (which will be many depending on whether you are moving/clicking) etc.
Answer by keld-oelykke · Jun 17, 2012 at 09:35 PM
You can surround your own code with Profiler.BeginSample and Profiler.EndSample (if your scripts are in an assembly, its a bit problematic, but it can be done).
If you put these tags within OnGUI called code, then you get nested entries in the Unity Pro Profiler.
Your answer
Follow this Question
Related Questions
Fill a circle by values with onGUI 0 Answers
How to display a set of guiText OnGUI 0 Answers
[Solved] GUI Error? 1 Answer
Ignore Input.GetMouseButtonUp for clicks that were used on GUI elements 2 Answers