Not sure when if became possible, but it looks like we are now able to have both a RefRW and EnabledRefRW field for the same component type in an aspect (thank you!). However, nesting this aspect inside of another aspect results in a source gen error.
Here is some example code:
public struct MyComp : IComponentData, IEnableableComponent
{
public float Value;
}
public readonly partial struct InnerAspect : IAspect
{
private readonly RefRW<MyComp> _data;
private readonly EnabledRefRW<MyComp> _enabled;
}
public readonly partial struct OuterAspect : IAspect
{
private readonly InnerAspect _inner;
}
And here is the error it generates:
Unity.Entities.SourceGen.AspectGenerator\Unity.Entities.SourceGen.Aspect.AspectGenerator\Test__Aspect_8699727920.g.cs(277,5): error CS1503: Argument 2: cannot convert from 'Unity.Entities.RefRW<Test.MyComp>' to 'Unity.Entities.EnabledRefRW<Test.MyComp>'
It appears to fail when generating the constructor for the outer aspect:
/// <summary>
/// Construct an instance of the enclosing aspect from all required data references.
/// </summary>
public OuterAspect(global::Unity.Entities.RefRW<global::Test.MyComp> outeraspect_inneraspect__dataRef,
global::Unity.Entities.EnabledRefRW<global::Test.MyComp> outeraspect_inneraspect__dataEnref)
{
this._inner = new global::Test.InnerAspect(outeraspect_inneraspect__dataRef,
outeraspect_inneraspect__dataRef);
}
It is passing the "dataRef" parameter as both the data and enabled bit parameter of the inner aspect constructor.