#Need a way to exclude entities from being processed by ComputeChildLocalToWorldJob

1 messages · Page 1 of 1 (latest)

tranquil idol
#

Is there any easy way to exclude entities from being processed by ComputeChildLocalToWorldJob?

I use a chunk system similar to Factorio, and I have a special component that I add to stuff that are in disabled chunks for performance reasons that, when added, excludes them from basically all queries across my systems, effectively excluding them from the factory simulation.

This works well for my own systems, but ComputeChildLocalToWorldJob in particular takes more time than simulating a whole late game factory, because it's processing tens of thousands of entities that have children, even though they aren't moving or doing anything in the simulation.

I added a system that removes/reconstructs entities' children (to force them to be excluded from this job) based on their disabled chunk status (and performance skyrocketed), but this is pretty cumbersome.

tranquil idol
#

Note I've also experimented with the Disabled component as well, which does satisfy my requirements somewhat, but has the undesirable effect of removing entities from rendering. I can probably just deal with this if this is the right solution though.

Disabled is just such a sledge hammer. Would be nice to have finer grained control here.

meager otter
#

Isn't this the purpose of WriteGroups?

#

I'm not all that familiar with the transform components, but several of them have a write group on LocalToWorld, which you could override to just do nothing.

tranquil idol
#

Write group does seem promising, however, the ComputeChildLocalToWorldJob doesn't seem to support it.

From the docs it needs to have .WithEntityQueryOptions(EntityQueryOptions.FilterWriteGroup) set, but it doesn't.

Unity allowing us to use write groups with their internal systems would be amazing, especially as more complex games with greater performance needs get made.

#

Somewhat frustratingly the ComputeRootLocalToWorldJob right above it does support write groups. They just didnt set the flag on the query for the ComputeChildLocalToWorldJob

There's probably some way to use this but I'm not sure how yet...