Search Unity

Question RegisterPhysicsRuntimeSystemReadOnly clarifications

Discussion in 'Physics for ECS' started by argibaltzi, Aug 2, 2022.

  1. argibaltzi

    argibaltzi

    Joined:
    Nov 13, 2014
    Posts:
    220
    Hi

    Can someone please explain how exactly this function works along with the write version?

    How is this meant to be used when you have input and output dependencies inside the physics system group?

    For example wait for the ExportPhysicsWorld to finish and before CopyPhysicsVelocityToSmoothing begins
     
  2. peaj_metric

    peaj_metric

    Joined:
    Sep 15, 2014
    Posts:
    146
    If you look into RegisterPhysicsRuntimeSystemReadOnly it is just a singleton query.
    So unity is just using the automatic dependency management.
    If your system needs to read or write physics it is handled the same way as dependency sorting when multiple systems need to read/write the same component.

    Using this...
    Code (CSharp):
    1. protected override void OnStartRunning()
    2.     {
    3.         this.RegisterPhysicsRuntimeSystemReadOnly();
    4.     }
    ...
    UpdateAfter(typeof(ExportPhysicsWorld))
    and
    UpdateBefore(typeof(CopyPhysicsVelocityToSmoothings))
    should work in your case
     
    argibaltzi likes this.