Why PlayerLoop are call 3 times when i run an empty project ?

Hello,

When I run an empty project and check Profiler, PlayerLoop and Editor are called 3 times. However, when I check Profiler of an old project, PlayerLoop and Editor are called 1 time. What is the reason for this and will this cause any problems in terms of optimization?

Note : I use Unity3D version 2020.3.19f1(LTS) or 2020.3.16f1(LTS)

Hello,
I’d suggest to check out Timeline view to understand what’s going on there. But basically, these are three different intervals within the frame, not 3 Player/Editor loops. Each interval does a set of work, before handing back over to the Editor/Player loop to do it’s corresponding thing within the frame.

Simply put, no.

The more complex truth is that the Playmode within the Editor always behaved differently to the Player and that this intermix of work with the editor has always made it a bit trickier to analyze Render Thread and GPU boundness. In fact, before 2020.1 the Stats display in the Game view has ignored the EditorLoop in it’s FPS calculation, suggesting that the player would run at this frame rate if it weren’t for the Editor. That was always very fuzzy math, as a Render Thread, VSync or GPU bound game would behave quite differently in a Standalone frame rate wise, in some cases prompting users to report a lower frame rate in their build compared to in the Editor, thinking it had to be a bug.

So the fact that the Player is running in intertwined lockstep with the Editor DOES make optimizing for a build by looking at the performance data of a Playmode run a bit tricky, but that’s always been the case. The golden rule is: profile on your target platform first to see what and where the problems lie, then use Playmode profiling while iterating on a possible solution, lastly verify that solution on device again.

Sidenote: there was a bug once on Mac where the full Player loop was executing the same frame intervals twice in one Editor frame, causing a regression in performance. That’s a separate thing and should be quite apparent not to be the case when looking at Timeline view.

1 Like

It was pretty self explanatory and I’m relieved :slight_smile: Thank you for answering my question.

Best regards,

1 Like

Happy to help :slight_smile:

1 Like