Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Showcase Parallel State Events

Discussion in 'Physics for ECS' started by tertle, Sep 21, 2023.

  1. tertle


    Jan 25, 2011
    Was meant to show this off a couple of months ago but I forgot but came up again recently on discord.

    The state components in the physics sample are quite popular and very useful: Events/Scripts/Stateful

    However they're pretty slow because it's all implemented single threaded. A couple of months ago I rewrote it to work in parallel to provide a pretty significant speed up with the exact same behaviour for the user.


    Left of the red line is the implementation for the physics sample. Right of the red line is my implementation.
    Source if anyone wants it:

    The only difference with the sample behaviour and my implementation is I removed the EntityA field as my implementation ensures EntityB is always the other entity so you don' t need to check this.

    Note, I also have plans at some point to add support to netcode prediction for this as well with manual rollback, but as I am currently not working in a netcode project this will be a little while~
    Last edited: Sep 21, 2023