Using the new Entities 1.0 package and Unity 2022.2.1f1 I am attempting to use a job to execute a command buffer on a world (the idea of a loading world), the world isn’t in the player loop or anything. Here’s the code of the job itself (not much to it)…
struct ExecuteCreatesCommandBufferJob : IJob
{
public ExclusiveEntityTransaction EET;
public EntityCommandBuffer CB;
public void Execute()
{
CB.Playback(EET);
}
}
I start it like this (_world is the ECS world)…
ExclusiveEntityTransaction eet = _world.EntityManager.BeginExclusiveEntityTransaction();
ExecuteCreatesCommandBufferJob executeJob = new ExecuteCreatesCommandBufferJob() { CB = _createCommandBuffer, EET = eet };
EntityManager entityManager = _world.EntityManager;
entityManager.ExclusiveEntityTransactionDependency = executeJob.Schedule();
When that last line executes I get an error in the unity console…
InvalidOperationException: EntityManager.ExclusiveEntityTransactionDependency must depend on the Entity Transaction job.
Unity.Entities.ComponentDependencyManager.set_ExclusiveTransactionDependency (Unity.Jobs.JobHandle value) (at Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/ComponentDependencyManager.cs:574)
Unity.Entities.EntityManager.set_ExclusiveEntityTransactionDependency (Unity.Jobs.JobHandle value) (at Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/EntityManagerExclusiveEntityTransaction.cs:34)
This seems like a bug or am I doing something wrong? This worked fine in the previous version of ECS.