Situation here's a little weird. I'm basically trying to schedule a big bunch of jobs, with no sync points in between, so World.Update can complete and give Unity the main thread back while all those jobs are processed in the background.
To enable that I've had to prepare some ComponentLookups as some systems do arbitrary non-structural modifications.
However, on a different thread just now (#1138412523691970602 message) I found myself using an IJobEntity which had a parameter with the same type as one of those ComponentLookups, and that's got Unity throwing an error about aliasing.
partial struct DoMovementJibJob : IJobEntity
{
public void Execute(ref MovementData movementData)
{
// ...
Just by movementData existing there, ECS creates an internal ComponentLookup<MovementData>, and that's clashing with the one that already exists.
I'm trying to find a way to use the existing one in this job (which is of course a lot more complex than above). This is my current theory:
partial struct DoMovementJibJob : IJobEntity
{
public void Execute(ref Context ctx /* the place I store my lookups */, Entity entity)
{
ctx.Lookups.MovementDatas[entity] = // ...
If I can combine that with an entity query like this to get the elements _without creating a new ComponentLookup...
EntityManager.CreateEntityQuery(new EntityQueryDesc
{
All = new ComponentType[] { typeof(StaticDestinationMovementData) },
});
... then maybe it'll all work fine? But I dunno how to schedule a IJobEntity given an EntityQuery 🤔 Is there a similar API to what I'm imagining elsewhere, or is there another approach I should be considering here?