DrawingManager.RemoveDestroyedGizmoDrawers super slow


Recently, I have discovered that DrawingManager.RemoveDestroyedGizmoDrawers is eating up 25% of my frame, which is kinda bonkers.

I lose any ability to play the game with a stable frame rate.

I have tried going through and disabling all the settings I could find regarding gizmos/lines, but some things, like NavMeshCuts, there is nothing I can find to disable.

Is there anyway to disable ALINE entirely?


I ended up having to move the package to my Packages folder, not in the normal PackagesCache, then manually editing DrawingManager.cs to disable itself upon entering play mode.

However, this is just a hack. Obviously, this is not ideal functionality.


Yeah, that method has been annoyingly slow. It’s surprisingly hard to just check if a bunch of objects still exist in Unity. But I think I have an alternative solution that would have better performance.


Would you mind trying with a newer version of Unity. It seems like in more recent versions of Unity, the null checking has been optimized significantly and thus this method should be a lot faster.

i also have the same problem with our project that the DrawingManager.RemoveDestroyedGizmoDrawers() takes up a lot of time to complete. We updated our unity version to 2022.3.8f1 and are using the beta version 4.3.79. In our project a newer unity version didn’t improve the performance at all.

Any update on this or anything we can do to improve the performance? We aren’t using ALINE at all.

@HanHan Do you think you could post a screenshot from the unity profiler?
I just did some benchmarks, and I really can’t get that method to become slow at all. Even with 5000 objects, each of which only draw a single line, the overhead of that method (about 0.1ms in total) is insignificant to the cost of drawing all of those lines.

Sorry for not responding. I will keep track of this thread from now on.
Here is a snapshot of one frame in our project. Can you say anything about it?


Things are expected to be very slow if you use deep profiling. Is it still slow if you don’t use deep profiling?

Could we have an option to disable the DrawingManager entirely when in play mode? It would give us an option to avoid this issue.


yes it is still slow even if we don’t use deep profile. We also have two calls to ALINE which makes up to 10% of our overall performance in Editor.


I’m making some changes for version 1.7.3 of ALINE, which I think might improve performance for you.

By the way. I can see that Filter Destroyed Objects in your profiler screenshot has a foldout arrow. That’s weird, because there shouldn’t be any markers nested deeper than that (unless you are using deep profiling). Can you see what is nested there?


i updated my A* Pathfinding Package from 4.3.92 to 4.3.94 and it did improve the performance a bit. Some frames now only need about 1.5ms other up to 4ms but still better then before. Since we are not using ALINE at all it would be cool if we could disable the behaviour if it’s possible to even get more fps in editor. :slight_smile:

Actually i don’t have the marker anymore in 4.3.94. I was using the version 9.3.82 while i was capturing the screenshots so i think the function changed during the last updates?
Also we are using multiple cameras thats why we have multiple calls to ALINE in different stacks.

ALINE is used internally by the A* Pathfinding Project for every component that draws gizmos. So I’m guessing you have a lot of these in your scene.

Yes we have a lot of agents in our scene around 2,000 each of them with a seeker and RVOController component. But only ~40-50 are active at the same moment the rest of them are deactivated and will be activated if the player is in the area. So i could say that i don’t need the gizmo rendering when the agent is deactivated but even when disabling the seeker or RVO component, ALINE is still doing something.

Is there any setting i can use to disable the gizmo drawing when my agent is disabled?

I’ll make some additional adjustments in the next update.

Sounds good. Thanks for that. :slight_smile:

Should be faster in the latest release.


just updated the package and the performance is much better now. ALINE overhead is now <1%. Thanks for that. :slight_smile:

1 Like