(Case 933679) BuildPipelineInterfaces causes slow EnterPlaymode performance

The more .cs files are located in the project, the longer the editor needs to enter playmode in an empty scene. I created a test project with 1000 .cs files, which is a reasonable number for a medium real-world project in my experience.

The slowest method when entering playmode, with more than 2-3 seconds in my tests, being BuildPipelineInterfaces.InitializeBuildCallbacks(). Please see the video that I attached to the bug-report.

Reproduce

  • Open user project
  • Click File/New Scene
  • Open Window/Profiler and enable “Profile Editor” and “Record”
  • Press Play
  • Once the editor switched to playmode, turn off “Record” in Profiler
  • Select the Peak sample in Profiler, find the “EnterPlaymode” entry and expand it down this path:
  • In the profiler Profiler drill down to…

Write down “Time ms” for the BuildPipelineInterfaces.InitializeBuildCallbacks() entry.

  • Remove all .cs files from the project
  • Repeat the test

Observe that without .cs files in the project, BuildPipelineInterfaces is a lot faster (100x faster in my tests).

Expected
The number of .cs files in the project should have no affect on how long the editor needs to EnterPlaymode. In this case, BuildPipelineInterfaces should not get slower the more files are in the project.

Ideally, BuildPipelineInterfaces.InitializeBuildCallbacks() should not be called during EnterPlaymode at all, but during builds only.

1 Like

Glad someone else noticed, I was just today writing up a little rant about this system:

It’s even worse than just play mode, it happens for every time a scene loads.

It is no specific to 2017.2 however so maybe we should continue this discussion in the thread I linked.

1 Like

I just received an email from Unity regarding this issue:

It can be found in the Unity Issue Tracker now:

1 Like

Should be fixed in f1.

1 Like

Excellent news, thanks!

Make that f2… sorry, my bad.

That’s fine too. Just happy it’s been fixed!