I ask ECS questions but I always got an old version answer of ECS.
For example, World.GetOrCreateSystem()
is not the right way in ECS 1.0
private EndSimulationEntityCommandBufferSystem endSimulationEcbSystem;
public void OnCreate(ref SystemState state)
{
endSimulationEcbSystem = World.GetOrCreateSystem();
// ...
}
1 Like
This is how you get EndSimulationEntityCommandBufferSystem
in com.unity.entities 1.0
now:
public void OnUpdate ( ref SystemState state )
{
var endSimulationEcbSystem = SystemAPI.GetSingleton<EndSimulationEntityCommandBufferSystem.Singleton>();
var ecb = endSimulationEcbSystem.CreateCommandBuffer( state.WorldUnmanaged );
}
It’s a singleton component now. No need to store a reference to it in a local field.
1 Like