Unity3d EntityQueryBuilder.ForEach未使用两个ComponentData和一个BufferElementData进行编译

Unity3d EntityQueryBuilder.ForEach未使用两个ComponentData和一个BufferElementData进行编译,unity3d,unity-ecs,Unity3d,Unity Ecs,我使用的是Unity实体组件系统。当我尝试编写以下代码时: Entities.WithAll<SomeComponentData, SomeComponentData2, SomeBufferElementData>() .ForEach((Entity entity, ref SomeComponentData componentData, ref SomeComponentData2 componentData2, DynamicBuffer<SomeBu

我使用的是Unity实体组件系统。当我尝试编写以下代码时:

Entities.WithAll<SomeComponentData, SomeComponentData2, SomeBufferElementData>()
        .ForEach((Entity entity,  ref SomeComponentData componentData, ref SomeComponentData2 componentData2, DynamicBuffer<SomeBufferElementData> buffer) => {

});
Entities.WithAll()
.ForEach((实体实体,引用SomeComponentData componentData,引用SomeComponentData2 componentData2,DynamicBuffer缓冲区)=>{
});
我得到以下错误:类型“Unity.Entities.Entity”不能用作泛型类型或方法“EntityQueryBuilder.ForEach(EntityQueryBuilder.F_D)”中的类型参数“T0”。没有从“Unity.Entities.Entity”到“Unity.Entities.IComponentData”的装箱转换。

当我只使用一个ComponentData和一个BufferElementData时,它编译得很好,即,以下各项起作用:

Entities.WithAll<SomeComponentData, SomeBufferElementData>()
        .ForEach((Entity entity,  ref SomeComponentData componentData, DynamicBuffer<SomeBufferElementData> buffer) => {

});
Entities.WithAll()
.ForEach((实体实体,引用SomeComponentData componentData,DynamicBuffer缓冲区)=>{
});

我看了ForEach代码,它是由大量组件和动态缓冲区排列生成的代码,但我找不到这个。(请参阅答案-我只是看得不够仔细!)在不支持ComponentData和BufferElementData的排列的情况下会发生什么情况?

结果证明这种排列是受支持的,但我必须先放置DynamicBuffer。即:

Entities.WithAll<SomeBufferElementData, SomeComponentData, SomeComponentData2>()
        .ForEach((Entity entity,  DynamicBuffer<SomeBufferElementData> buffer, ref SomeComponentData componentData, ref SomeComponentData2 componentData2) => {

});
Entities.WithAll()
.ForEach((实体实体、DynamicBuffer缓冲区、ref SomeComponentData componentData、ref SomeComponentData2 componentData2)=>{
});
我通过查看
IJobForEachWithEntity_XXX
接口发现了这一点。我发现有一个
IJobForEachWithEntity_EBCC
接口,它告诉我缓冲区必须先于组件

希望这将节省一些人几个小时的时间