Hello all. I am attempting to take advantage of Unity’s ECS system to build a pipelined raycast system. Through passing messages, the results of one parallel raycasting System is passed to another, eventually exposing methods such as LineOfSight, ProjectileCanPassThrough, CoverDisparity, etc. The way the system currently passes messages is by creating an Entity to which it attaches some Components holding the result of the previous stage in the pipeline. However, upon profiling, I encountered a bottleneck in creating/destroying the Entities. I understand that you can use Jobs in conjunction with EntityCommandBuffer to parallelize this step, but I’m wondering if there are any better alternatives to decoupled message passing, or even better, if Unity plans on releasing such features.
There is something like batch raycast.
It maybe more suitable, for what you need.
Instead of creating / deleting entities, which should be fast anyway, you can just tag them accordingly, with components, to filter them out.
Other than that, I am not sure why you passing raycast data results. If I understand correctly?
The system currently already uses batched raycasts. It passes results from “simpler” systems like “GetAllHits” to more “complex” ones like “CalculateCoverDisparity”. Yeah, thanks for suggesting that I just remove/add components instead of creating entirely new entities. I’ll try to incorporate that
1 Like