Search Issue Tracker

Won't Fix

Won't Fix in 1.0.X

Votes

2

Found in [Package]

1.0.X - Entities

Issue ID

ECSB-549

Regression

No

InvalidOperationException is thrown when the method WithNone<> is used with a struct that implements IEnableableComponent

Package: Entity Component System (ECS)

-

How to reproduce:
1. Open the “Entities.zip“ project
2. Enter the “SampleScene“
3. Enter Play Mode and observe the Console

Expected result: No errors are seen
Actual result: InvalidOperationException error is seen

Reproducible with: 1.0.8, 1.0.11 (2022.3.5f1)

Reproducible on: Windows 10

Error:
InvalidOperationException: The previously scheduled job TestSystem1:TestJob writes to the ComponentTypeHandle<TestComponent2> TestJob.JobData.__TypeHandle.__TestComponent2_RW_ComponentTypeHandle. You are trying to schedule a new job TestSystem2:TestJob, which reads from the same ComponentTypeHandle<TestComponent2> (via TestJob.safety). To guarantee safety, you must include TestSystem1:TestJob as a dependency of the newly scheduled job.

  1. Resolution Note:

    There are no fixes planned for this Bug

  2. Resolution Note (1.0.X):

    After some further investigation, I don't think we can fix this in Entities 1.x without breaking API changes. At the point where WithNone<T> is specified and system type dependencies are added, we simply can't tell whether the user's intent is that the type is missing (in which case, no type dependency should be added) or disabled (in which case, a read or read/write dependency is necessary). I've filed a ticket to revisit EntityQuery type categories to avoid this ambiguity.

    The workaround in the meantime is to prefer the WithAbsent<T> or WithDisabled<T> alternatives to WithNone<T>, which let you more explicitly declare a query's expectations around an excluded component type. Specifically, if a system will be re-enabling disabled types in a job; it should use WithDisabled<T> instead of WithNone<T>. It seems uncommon that a query would genuinely not care whether a type was absent or disabled, but in that case (if the type is actually not accessed at all) then WithNone<T> would be appropriate.

Comments (1)

  1. Ammar_Negm

    Jul 18, 2023 11:12

    pls fix

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.