In previous renditions of my setup, I had a component per message type (which there are a fair amount), where all of the components had a BlobAssetReference to their own type. This made the system easy to work with, but accrued quite a bit of technical debt whenever a new message type was to be added.
I recently updated to 1.1-exp and noticed that somethings have changed, such as using ISystems with generics. This is extremely helpful and I was able to simplify a blob disposal method that cut down on the amount of boilerplate without sacrificing performance, but the final point now that is causing grief is using an IJobEntity with a generic component. Note, even at compile time, the component is known, but the source generated is having a problem handling it correctly.
Below is an example of how to cause Unity to spit out something along the lines of
error CS0426: The type name 'InternalCompilerQueryAndHandleData' does not exist in the type 'TestGenericComponentSystem.JobTestGen
This is a little unexpected given that Dynamic buffers are nearly the same thing in this regard. Is there something I can do, to have the generated source to be valid? The Job itself is not generic, only the component being used is. I can of course write this as an IJobChunk, but that seems overkill for something that is working on a different existing generic of a similar nature.
[BurstCompile]
public partial struct TestGenericComponentSystem : ISystem {
public void OnUpdate(ref SystemState state) {
state.Dependency=new JobTestGenericComponent().ScheduleParallel(state.Dependency);
}
public struct Blob {
public int K;
}
[BurstCompile]
public partial struct JobTestGenericComponent : IJobEntity {
private void Execute(in BlobComponent<Blob> blobComponent) {
}
}
[BurstCompile]
public struct BlobComponent<T> : ICleanupComponentData, IDisposable where T : unmanaged {
public ref T Value => ref _blob.Value;
private BlobAssetReference<T> _blob;
public BlobComponent(BlobAssetReference<T> blobRef) {
_blob = blobRef;
}
[BurstCompile]
public void Dispose() {
_blob.Dispose();
}
}
}
Do note, that this with Dynamic buffers work perfectly fine:
[BurstCompile]
public partial struct TestBufferSystem : ISystem {
public void OnUpdate(ref SystemState state) {
state.Dependency=new JobTestBuffer().ScheduleParallel(state.Dependency);
}
public struct BufferData : IBufferElementData {
public int K;
}
[BurstCompile]
public partial struct JobTestBuffer : IJobEntity {
private void Execute(in DynamicBuffer<BufferData> blobComponent) {
}
}
}