- Home /
Measuring all the Update loops combined
Hello everybody,
I would like to have a better process for profiling (and ultimately improving) my frame rate on slower devices.
Right now, I have to design some test levels, and send them to people with slower devices, to get the results. The process is not efficient for me.
So, my question is this:
Is there any way to measure the SUM of all the things that happen in a single frame, without having to add code to each of my Update() loops?
I mean is there any callback that is invoked at the beginning of the frame processing loop [ just before any Update() ] and one that is invoked at the end [ just after all Update()s ] ?
Answer by whydoidoit · Nov 09, 2012 at 08:56 AM
Well you could have 2 scripts and set their script execution order - one to be very very early and one to be very very late - then use a static variable to start the timing (using .NET time) in the early one's Update and top it off in the late one (or perhaps LateUpdate in the later one). That could do it.
Hmm... interesting. Thanks for the quick reply. Let me take a look at this approach and report back if I succeed or have any questions.
EDIT: Quick question - why .NET time and not Unity's?
Oh .NET time because Unity time is linked to the game loop and won't necessarily update between calls on the same frame.
Thanks a lot. Used C# Stopwatch, and already found information that will help in pinpointing the FPS drainer.
@whydoidoit: Time.realtimeSinceStartup does update between calls in the same frame.
Your answer
Follow this Question
Related Questions
Few versus many Update() routines? 1 Answer
Performance spikes 1 Answer
Animator.Play() in update, Performance?? 0 Answers
Does using an empty or inactive Update function take up memory? 1 Answer