Hi. I have a question about new JobComponentSystem.Entities and its usage in static helper method.
Is it safe to use JobComponentSystem.Entities in other static method? like this:
static class MyQueryFactory
{
public static ForEachLambdaJobDescription CreateCommonQuery(ForEachLambdaJobDescription entities, ref int paramForCapture)
{
return entities.ForEach(...); // capture paramForCapture in lambda
}
}
class MySystem : JobComponentSystem
{
JobHandle Update(JobHandle inputDeps)
{
int localValue = 3;
return MyQueryFactory.CreateCommonQuery(this.Entities, ref localValue).Schedule(inputDeps);
}
}
Thanks.
GilCat
2
Seems like all of those attempts fall into this error:
error DC0011: Every Entities.ForEach statement needs to end with a .Schedule(), .ScheduleParallel() or .Run() invocation.
It would be nice to have this so we could reuse all those jobs without having to write the same/similar lambda expression over and over again.
1 Like
Yes, I definitively want to be able to create static utilities function, did you manage to find a way to do it ?
The same problem occurs when using SystemBase
Same issue when trying to go for extension methods.
Best bet is for the utility method to rely on IJob or IJobChunk I guess.
Abbrew
5
Could allowing extension methods in the Entities method chain be implemented in the next Entities release?