Search Unity

Jobs, how would behave in this Physic Scenario?

Discussion in 'Physics for ECS' started by sebas77, Jul 25, 2019.

  1. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,644
    I would like some advice here: it seems to me that a scheduled ICollisionEventsJob will be executed in parallel, for each collision I guess (please confirm)

    in our job implementation we got these fields:

    Code (CSharp):
    1. [NativeDisableParallelForRestriction] public BufferFromEntity<CollisionEventData> CollisionsFromEntity;
    2. [ReadOnly] public ComponentDataFromEntity<PhysicsVelocity> PhysicsVelocityGroup;
    3. [ReadOnly] public ComponentDataFromEntity<PhysicsMass> PhysicsMassGroup;
    4. [ReadOnly] public NativeSlice<RigidBody> Bodies;
    5. [NativeFixedLength(1)] public NativeArray<uint> idCounter;
    I guess I could mark the first one as read only instead of NativeDisableParallelForRestriction (which worked), but what would the effect of the last NativeArray be? Would writing in it force everything to run in serial instead of parallel?