I'm trying to do the following:
private void AssignPlayer()
{
EntityQuery playerQuery = GetEntityQuery(ComponentType.ReadOnly<PlayerTag>());
Entity playerEntity = playerQuery.ToEntityArray(Allocator.Temp);
Entities.
WithAll<ChaserTag>().
ForEach((ref TargetData targetData) =>
{
if (playerEntity != Entity.Null)
{
targetData.targetEntity = playerEntity;
}
}).Schedule();
}
But the line that assigns targetData.targetEntity = playerEntity;
throws the error:
Cannot implicitly convert type 'Unity.Collections.NativeArray<Unity.Entities.Entity>' to 'Unity.Entities.Entity'