#Disabled, Reading and Enabled Ref bug

1 messages · Page 1 of 1 (latest)

small atlas
#

The following job will throw an entityQuery duplicate component error


public partial struct DisabledEnableableBug : ISystem
    {
        public void OnUpdate(ref SystemState state)
        {
            new BugJob().ScheduleParallel();
        }
    }

    [WithDisabled(typeof(Revivable))]
    public partial struct BugJob : IJobEntity
    {
        public void Execute(
            ref Revivable revivable,
            EnabledRefRW<Revivable> revivableBit
        )
        {
            revivable.StartTick = 0;
            revivableBit.ValueRW = true;
        }
    }

    public struct Revivable : IComponentData, IEnableableComponent
    {
        public int StartTick;
    };
#

@neon ore hey, hoping this can be looked into, posting the error shortly

hushed phoenix
#

this has been reported since 1.0 first came out unfortunately, just the pain with code gen

#

why i implemented a rule for myself to not to use ienableable on anything but tags

#

i'd rather make 2 components, 1 just for enable state to avoid having issues like this

#

btw it was meant to be fixed in 1.1.0-exp.1

#

Users can now specify duplicate components in the same IJobEntity.Execute() method, insofar as exactly one of them is wrapped in EnabledRef<T>.

#

but as you have pointed out, as well as at least another person i've seen, it doesn't actually seem fixed

#

(more of a @sand valley problem than ecuzzillo)

small atlas
#

public void Execute(
ref Revivable revivable,
EnabledRefRW<Revivable> revivableBit
)
{
revivable.StartTick = 0;
revivableBit.ValueRW = true;
}

I believe this works now, but adding additional disabled tag breaks it

small atlas
hushed phoenix
#

oh the disable part i missed that