Editor loop high thread utilization on play mode

Hello

I have created a small test project to see how unity 2020.1 beta will work with my current plugins and on entering play mode, unity starts to lag very badly(clicks registering after ~10 sec)

The external packages i use(asset store previously) are:

  • Odin Inspector
  • Json .NET (.dll in the packages folder)

From preview packages i use the 2d Extras package.
I dont have any OnUpdate code and only one GameObject that has an OnStart method that draws a test shape on a Tilemap.

What could’ve caused the issue? My guess was that it was Odin, however when i loaded an empty project without Odin(and default manifest.json) the issue remained.
These are the contents of my default Packages/manifest.json file:

{
  "dependencies": {
    "com.unity.collab-proxy": "1.3.7",
    "com.unity.ide.rider": "1.2.1",
    "com.unity.ide.visualstudio": "2.0.1",
    "com.unity.ide.vscode": "1.2.0",
    "com.unity.test-framework": "1.1.13",
    "com.unity.textmeshpro": "3.0.0-preview.1",
    "com.unity.timeline": "1.3.2",
    "com.unity.ugui": "1.0.0",
    "com.unity.modules.ai": "1.0.0",
    "com.unity.modules.androidjni": "1.0.0",
    "com.unity.modules.animation": "1.0.0",
    "com.unity.modules.assetbundle": "1.0.0",
    "com.unity.modules.audio": "1.0.0",
    "com.unity.modules.cloth": "1.0.0",
    "com.unity.modules.director": "1.0.0",
    "com.unity.modules.imageconversion": "1.0.0",
    "com.unity.modules.imgui": "1.0.0",
    "com.unity.modules.jsonserialize": "1.0.0",
    "com.unity.modules.particlesystem": "1.0.0",
    "com.unity.modules.physics": "1.0.0",
    "com.unity.modules.physics2d": "1.0.0",
    "com.unity.modules.screencapture": "1.0.0",
    "com.unity.modules.terrain": "1.0.0",
    "com.unity.modules.terrainphysics": "1.0.0",
    "com.unity.modules.tilemap": "1.0.0",
    "com.unity.modules.ui": "1.0.0",
    "com.unity.modules.uielements": "1.0.0",
    "com.unity.modules.umbra": "1.0.0",
    "com.unity.modules.unityanalytics": "1.0.0",
    "com.unity.modules.unitywebrequest": "1.0.0",
    "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    "com.unity.modules.unitywebrequestaudio": "1.0.0",
    "com.unity.modules.unitywebrequesttexture": "1.0.0",
    "com.unity.modules.unitywebrequestwww": "1.0.0",
    "com.unity.modules.vehicles": "1.0.0",
    "com.unity.modules.video": "1.0.0",
    "com.unity.modules.vr": "1.0.0",
    "com.unity.modules.wind": "1.0.0",
    "com.unity.modules.xr": "1.0.0"
  }
}

EDIT:
I have tested the same projects in earlier versions of unity and such issue only appears in 2020.1 beta

EDIT 2:
I have tested the issue with unity 2020.1.0b10 and the issue is still present

1 Like

So, for troubleshooting i have uninstalled all beta unity versions i have and reinstalled 2020.1.0b10 on C drive.
After that i have loaded a new blank project and used profiler to see thread utilization.

Turns out that right after entering play mode, EditorLop spikes up to ~200ms and stays there for some time.


After some time, however it calms down and unity resumes to working as normal(without staying at 200-300ms cpu utilization), however it it literally unbearable as it takes about a minute to recover(each frame takes about 300ms to execute after all)

I am not using any external plugins and the project is blank(contains only camera and directional light.)
This is the profiler output saved ~300 frames in after entering play mode.

Such issue is not present on the 2019 version of unity

Have you checked what inside “EditorLoop” causes this?

  • Open Profiler window

  • Switch from “Timeline” to “Hierarchy” in the Profiler

  • Change drop-down from “Playmode” to “Editor”

  • Enable “Record”

  • Press Play

If you then expand the “EditorLoop” node in the Profiler all the way down, it should reveal what those 300ms causes.

Thanks for pointing that out, i have done so and turns out that the part of editor loop that causes the 300ms utilization is TickSceneTracker
5914085--631643--Annotation 2020-05-28 233603.png
After some time running i also got a fatal GC error after which unity crashed.

I suppose that these are related, as the GC error only happens in the beta version after some time has passed.
My guess is that something in the TickSceneTracker causes a memory leak, causing garbage collection to work way to hard each frame thus causing the utilization to spike. This is just a guess though.

Can you continue to expand the first item of the “top cost”. In this case please expand “EditorApplication.Internal_CallUpdateFunction” and then expand the first child of this one and so on. It should occasionally show where the actual cost comes from.

Like shown in this post .

This is the “high cost” part of the EditorLoop tree5914214--631670--Annotation 2020-05-29 002334.png

Any ideas how to solve the problem?

I have tried removing different packages through package manager and changing my layout to only contain scene view, hierarchy and information and the issue is still present.
Profiler does not show anything particluar that i can see, only TickSceneTracker →

Found out that resetting the layout fixes the issue. No idea still what couldve caused it, as my layout didnt contain anything more than standard ui elements

1 Like

Can confirm. Updated test project playground from 2019.3 to 2020.1.0b11 and when entering play mode I got 3-5 FPS instead of 350-400. Editor Loop was trough the roof in the profiler. After I read your comment I did a reset of my layout (which was pretty much default + a few extra tabs) and everything is back to normal performance-wise.

No idea what caused it though…

Hi, I believe this issue has been fixed with 2020.2.0a14

Using 2021.3.13f1 I am having the same issue.