Closed mbaker3 closed 1 year ago
Ah... sorry. I just saw this in action here: https://github.com/decline-cookies/station-x/pull/430/
I think we should remove the ComponentSystemBase
extensions and just have the EntityManager one.
This line:
dependsOn = JobHandle.CombineDependencies(dependsOn, this.GetDependency(ComponentType.ReadWrite<IsSelected>()));
Reads to me like we are getting this system's dependency for the component which is a bit confusing since my system may not interact with the component at all.
dependsOn = JobHandle.CombineDependencies(dependsOn, EntityManager.GetDependency(ComponentType.ReadWrite<IsSelected>()));
This reads better that we are trying to get whatever this component's global access dependency is.
This would also read well:
dependsOn = JobHandle.CombineDependencies(dependsOn, ComponentType.ReadWrite<IsSelected>().GetDepencency(ref EntityManager));
Updated based on PR feedback.
ComponentSystemBase
extension methods and create ComponentType
extension methodsparams
EntityDataAccess->DependencyManager
. This enforces main thread access. Originally I misinterpreted what the "Exclusive Transaction" assertion was actually asserting.My only question is how does the other side of this work?
I have a TaskDriver job that operates out of band and requires access to
MyComponent : IComponentData
.So TaskDriver gets the dependency for me so I know when I can use it which is great.
How do I let Unity know to update it's dependency for
MyComponent
to wait on my TaskDriver job?
At the moment, you don't. I'll fast follow with this functionality in a new PR.
Provides ability to get the job dependency on an arbitrary component or set of components.
@jkeon This may provide the opportunity to decouple task drivers from systems (if we want that)
Question: Does making these extension methods of
ComponentSystemBase
andEntityManager
make sense? Alternatively (or additionally) we can have the extension methods work off of theComponentType<T>
instances themselves. Examples:ComponentType<MyComponent>.ReadOnly().GetDependency(EntityManager)
(or system)myComponentCollection.GetDependency(EntityManager)
(or system)EntityManager
andComponentSystemBase
are the providers for the pointer to the underlyingComponentDependencyManager
instance. That's why the current extension methods are setup as they are.What is the current behaviour?
Currently, the only way to get the scheduling dependency of a collection of components is through an
EntityQuery
.What is the new behaviour?
With a reference to
EntityManager
orComponentSystemBase
instance developers can calculate the scheduling dependency on an arbitrary collection of components.What issues does this resolve?
What PRs does this depend on?
Does this introduce a breaking change?