this is from unity sample.
struct SpawnSettings : IComponentData, ISpawnSettings
{
public Entity Prefab { get; set; }
public float3 Position { get; set; }
public quaternion Rotation { get; set; }
public float3 Range { get; set; }
public int Count { get; set; }
}
......
//here I change <T> to <SpawnSettings>
abstract partial class SpawnRandomObjectsSystemBase<SpawnSettings> : SystemBase where SpawnSettings : struct, IComponentData, ISpawnSettings
{
......
protected override void OnUpdate()
{
EntityCommandBuffer ecb = InitEntityEcbS.CreateCommandBuffer();
EntityCommandBuffer.ParallelWriter ecbParallel = ecb.AsParallelWriter();
line227 Entities
line228 .ForEach((Entity e, int entityInQueryIndex, ref SpawnSettings spawnSettings) =>
{
//Initiate Entities.
......
}
}
}
I got only these 3 errors, I modify the original code for compiled successfully.
Assets\Scripts\SpawnRandomObjectsAuthoring.cs(228,65): error DC0050: Type SpawnSettings cannot be used as an Entities.ForEach parameter as generic types and generic parameters are not currently supported in Entities.ForEach
Assets\Scripts\SpawnRandomObjectsAuthoring.cs(227,17): error DC0053: Entities.ForEach cannot be used in system SpawnRandomObjectsSystemBase as Entities.ForEach in generic system types are not supported.
Assets\Scripts\SpawnRandomObjectsAuthoring.cs(227,17): error DC0004: Entities.ForEach Lambda expression captures a non-value type âthisâ. This is only allowed with .WithoutBurst() and .Run()