#Use EnabledRefRW and modify for same component in IJobEntity?

1 messages · Page 1 of 1 (latest)

runic field
#

I want to modify value of a component and disable it in IJobEntity, like the following. But I got a error message: CountdownTimeJob has duplicate components of same type GASCore.Systems.LogicEffectSystems.Components.Duration. Remove all but one to fix.

    public partial struct CountdownTimeJob : IJobEntity
    {
        public float                              DeltaTime;

        void Execute(ref Duration duration, EnabledRefRW<Duration> durationEnableState)
        {
            duration.Value -= this.DeltaTime;
            if (duration.Value <= 0) durationEnableState.ValueRW = false;
        }
    }

What is the correct way to do this?