Skip to content

Could you remove that function from Netcode scripts or disable it in playmode? #3017

@Marc477

Description

@Marc477

There is a script in Netcode that makes my project lag a lot when playing from the Editor.

It's an editor script that just send some kind of Warning but it makes the whole game lag.

I did a post with more details here:
https://discussions.unity.com/t/performance-spike-because-of-a-netcode-networkmanagerhelper-editor-script-any-way-to-disable-that/1505627

But basically it's its NetworkManagerHelper.cs this function

private static void EditorApplication_hierarchyChanged()
        {
            var allNetworkManagers = Resources.FindObjectsOfTypeAll<NetworkManager>();
            foreach (var networkManager in allNetworkManagers)
            {
                if (!networkManager.NetworkManagerCheckForParent())
                {
                    Singleton.CheckAndNotifyUserNetworkObjectRemoved(networkManager);
                }
            }
        }

I have a large scene with a lot of gameobjects, most have their scripts/components disabled so the performances are very good in the build. It's just that this function makes the game unplayable from the editor.

Maybe just add this at the start of the function?

if(Application.isPlaying)
    return;

I could edit it myself, its just that this requires copying netcode script in the project instead of using the package manager, and makes updating version more complex.

Metadata

Metadata

Labels

priority:highThis issue has high priority and we are focusing to resolve itstat:importedStatus - Issue is tracked internally at Unitytype:bugBug Report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions