Pure ECS : Projectiles particles

Hey everyone,
Im looking for the most efficient way to instantiate thousands of projectile particles using C# job.
The idea is each bullet instantiated contains a velocity, last framePosition and a particle system.
The bullet is moving over frames and raycasting between current position and last frame position using the DOTS unity physics.
In case of hitCollision the job applies the impact effects , damage … then destroy the entity.

So my question is how to control the particale system within a job and is it event possible ?

The recommended approach is to use:
EntityManager.Instantiate(Entity prefab, NativeArray instances);

This API works in batch and is very well optimized for the case of lots of same instances instantiated in batch. The API is called from main thread. So you want your job to generate a small piece of data that carries how much and where to instantiate the entities.

4 Likes

Thank you!!!
you are awesome!