#How to get ECB without managed calls?

1 messages · Page 1 of 1 (latest)

earnest cliff
#

public static EntityCommandBuffer GetEndSimulationECB(this SystemState state) { var system = state.World.GetExistingSystemManaged<EndSimulationEntityCommandBufferSystem>(); return system.CreateCommandBuffer(); }

This can't be bursted because of the GetExistingSystemManaged() call. How can I get the same ECB without managed calls?

inner star
#

Have you tried getting the ECB systems' singletons?

earnest cliff
#

What would that look like?

inner star
#

I did this two days ago, but in a SystemBase:

var ecb = SystemAPI.GetSingleton<EndFixedStepSimulationEntityCommandBufferSystem.Singleton>().CreateCommandBuffer(World.Unmanaged);
#

Apparently you'd replace World.Unmanaged with state.WorldUnmanaged in an ISystem

earnest cliff
#

Yes, perfect. Worked like this: SystemAPI.GetSingleton<EndFixedStepSimulationEntityCommandBufferSystem.Singleton>().CreateCommandBuffer(state.WorldUnmanaged);

inner star
#

Obviously use EndSimulationEntityCommandBufferSystem if that's what you wanted

earnest cliff
#

Still getting errors, checking if they are from the same code: CreateGridSystem.cs(64,13): Burst error BC1016: The managed function `Unity.Entities.SystemState.get_World(Unity.Entities.SystemState* this)