Skip to content

Editor Perf - NetworkManagerHelper.EditorApplication_hierarchyChanged #2613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tristan-elation opened this issue Jul 10, 2023 · 6 comments
Closed
Assignees
Labels
priority:high This issue has high priority and we are focusing to resolve it stat:imported Status - Issue is tracked internally at Unity type:bug Bug Report

Comments

@tristan-elation
Copy link

Description

I'm experiencing some serious slow downs in the editor from the following:

EditorApplication.hierarchyChanged: Unity.Netcode.Editor.NetworkManagerHelper.EditorApplication_hierarchyChanged

I'm seeing on the order of 100ms per frame or more on this call in the editor profiler.

I dug in a bit and it looks like maybe this is the source of perf issues as I have a lot of game objects in my scene?
Library\PackageCache\[email protected]\Editor\NetworkManagerHelper.cs Line 113:
var allNetworkManagers = Resources.FindObjectsOfTypeAll();

Reproduce Steps

  1. Create or open a unity project with 100K+ game objects in the scene and a NetworkManager in the scene.
  2. Create a script in your scene that causes EditorApplication.hierarchyChanged to get fired each frame.
  3. Play the game in editor with the editor profiler enabled.

Actual Outcome

Observe that Unity.Netcode.Editor.NetworkManagerHelper.EditorApplication_hierarchyChanged is taking a very long time, and the vast majority of the frame and editor loop time.

Expected Outcome

Unity.Netcode.Editor.NetworkManagerHelper.EditorApplication_hierarchyChanged would have have negligible impact on editor perf.

Environment

  • OS Windows 10 [Specs: Intel i7 @ 3.6GHz, 32 GB RAM, 2080 Ti RTX]
  • Netcode Version: [e.g. 1.0.0-pre.6]
  • Netcode for GameObjects Version: 1.5.1
  • Unity Editor version: 2022.3.4f1

Additional Context

As a workaround to the perf, I tried finding the root cause of EditorApplication.hierarchyChanged getting called every frame, but haven't been able to efficiently debug or identify the cause for that getting invoked yet. Regardless, I would not expect NetworkManagerHelper to have the negative impact on perf that we are seeing.

@tristan-elation tristan-elation added stat:awaiting-triage Status - Awaiting triage from the Netcode team. type:bug Bug Report labels Jul 10, 2023
@fluong6 fluong6 added priority:medium This issue has medium priority and may take some time to be resolved good-first-issue Contributions are welcome. Good first issue for newcomers or first time contributors. stat:import Status - Issue is going to be saved internally and removed stat:awaiting-triage Status - Awaiting triage from the Netcode team. stat:import Status - Issue is going to be saved internally labels Jul 12, 2023
@NoelStephensUnity NoelStephensUnity removed the good-first-issue Contributions are welcome. Good first issue for newcomers or first time contributors. label Oct 5, 2023
@AlexandreHurbe
Copy link

AlexandreHurbe commented Mar 6, 2024

Hi, just wanted to confirm that I'm encountering this issue as well in a small test scene with less than a hundred gameobjects (including non NetworkObjects). In the screenshot (ignore highlighted) you can see the function takes 59ms.

Windows Version: Windows 11 Build 22H2
Unity Version: 2022.3.20f1
Netcode for Game Objects: 1.8.1

image

@joaovictoralencar
Copy link

joaovictoralencar commented May 2, 2024

I'm having the same issue. A lot of fps drops. Would be great at least being able to disable this feature.

@NoelStephensUnity NoelStephensUnity added priority:high This issue has high priority and we are focusing to resolve it stat:import Status - Issue is going to be saved internally and removed priority:medium This issue has medium priority and may take some time to be resolved labels May 2, 2024
@JordiBlancoDev
Copy link

I'm having this issue too, everytime I activate, deactive, instantiate or destory a gameobject, the fps drops, the more gameobjects on the scene, the more the fps drops, even without initiating anything related to the netcode.

I tried to reproduce this in different scenes, in an empty scene with only a camera and an empty GameObject I experienced a 2%-5% fps drops, in a scene with around 50 GameObjects (all being UI GameObjects) i experienced around 30% fps drops, and in a scene with around 200 GameObjects i experienced around 70% fps drop.

image

I'm using a Ryzen 5 1600, 16GB of RAM, Radeon RX 580.
OS Windows 10 Pro 22H2
Unity Version 2022.3.17f1
NGO Version: 1.8.1 - 1.8.0 - 1.7.1 (haven't tried older versions)

@joaovictoralencar
Copy link

joaovictoralencar commented May 9, 2024

I believe @NoelStephensUnity is already aware of this. Let's hope we can get an update ASAP. Without this, I have like more
15FPS, which make my game run at 20~25fps instead of 5 in the editor.

@joaovictoralencar
Copy link

joaovictoralencar commented Sep 18, 2024

I see this was fixed at 2.0.0 @NoelStephensUnity, however I see that 2.0.0 is only compatible with Unity 6000.0+. Any chances this can also be compatible with Unity LTS 2022? My project with a big amount of GOs in the hierarchy is using Unity 2022 LTS

@fluong6 fluong6 added stat:imported Status - Issue is tracked internally at Unity and removed stat:import Status - Issue is going to be saved internally labels Oct 7, 2024
@NoelStephensUnity
Copy link
Collaborator

This issue was resolved in #3027 and should be included in NGO v1.12.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:high This issue has high priority and we are focusing to resolve it stat:imported Status - Issue is tracked internally at Unity type:bug Bug Report
Projects
None yet
Development

No branches or pull requests

7 participants