Hello!
We have updated from Entities 0.16 and Unity 2020 to Entities 1.0 and Unity 2022.
We solved a lot of problems and had a good release.
However, we still have one very annoying problem.
If the editor is in debug mode (for example to use breakpoints), then the ECBs begin to waste an incredible amount of time.
For example, adding one component to one entity can take about 0.5 seconds. If you enable deep profiling for analysis, you can see that when working with buffers, EntityQueryManager.TestMatchingArchetypeAll is called tens of thousands of times.
Our project is very large, we have about 1000 components and 3000 systems.
For the test, we tried to transfer the piece of code causing this problem to a new project on the same version of packages and unit. The problem is not reproducible. There are no calls to EntityQueryManager.TestMatchingArchetypeAll at all.
Yes, the new project does not have the same scale as the original project, but there should probably be at least one call when working with the buffer.
Apparently the problem is in some extensions we wrote over version 0.16, but I can’t figure out what exactly could be causing such a problem.
Perhaps someone has encountered something similar or has ideas on how this could be fixed?
` private EntityCommandBufferSystem TestCommandBuffer =>
testCommandBuffer ??= World.GetExistingSystemManaged<BeginSimulationEntityCommandBufferSystem>();
private EntityCommandBufferSystem testCommandBuffer;
protected override void OnUpdate()
{
var ecb= TestCommandBuffer.CreateCommandBuffer();
Entities
.WithAll<TestComponent1>()
.WithAll<TestTagComponent1>()
.WithNone<TestTagComponent3>()
.ForEach((Entity entity) =>
{
ecb.AddComponent<TestTagComponent3>(entity);
})
.WithoutBurst()
.Run();
}
`