#How do i run jobs from System A in parallel with jobs from System B?

1 messages · Page 1 of 1 (latest)

shell crater
#

Right now the jobs from system B always start after all the jobs from system A completes even if they don`t read/write to the same components.

shell crater
#

i`m trying to run a system in parallel with KinematicCharacterDeferredImpulsesJob (It is single threaded) with no success
It always end up running before or after it.

#

@regal shore Is it possible?

pulsar wharf
#

Can you show how you're scheduling jobs in system A and B?

Typically if the same components are used, then the System A's dependency is automatically waited on before running system B jobs. If they are completely decoupled then there maybe some excessive waiting done on our end which should be addressed.

shell crater
#

They are decoupled

#

This jobs cant run together with DeferredImpulses but they dont use any component from it

#

[BurstCompile]
public void OnUpdate(ref SystemState state)
{
DamageableComponents.Update(ref state);

    ConeDamageProducerJob producer = new ConeDamageProducerJob()
    {
        Time = SystemAPI.Time,

        CommandBuffer = SystemAPI.GetSingleton<EndFixedStepSimulationEntityCommandBufferSystem.Singleton>()
        .CreateCommandBuffer(state.WorldUnmanaged)
        .AsParallelWriter(),

        Events = Events.AsParallelWriter(),

        PhysicsWorld = SystemAPI.GetSingleton<PhysicsWorldSingleton>()
        .PhysicsWorld
    };

    ConeDamageConsumerJob consumer = new ConeDamageConsumerJob()
    {
        Events = Events
    };


    state.Dependency = producer.ScheduleParallel(state.Dependency);
    state.Dependency = consumer.Schedule(state.Dependency);
}
shell crater
#

i`m trying to force it to run at same time/after the deferred input system but it does not run in parallel

[UpdateAfter(typeof(KinematicCharacterDeferredImpulsesSystem))]
[BurstCompile]
public partial struct ConeDamageSystem : ISystem```
shell crater
#

Yeah, no matter what they never run together

shell crater
#

I tried to do the same thing with my own system (SpatialEntity) and it works

#

Looks like only KinematicCharacterDeferredImpulsesSystem can`t run in parallel with other systems

terse robin
#

I'll admit I'm not seeing anything that could cause this at the moment. The KinematicCharacterDeferredImpulsesJob writes to: LocalTransform, PhysicsVelocity and KinematicCharacterBody so jobs that don't deal with these components should be able to run at the same time. There's also nothing special about KinematicCharacterDeferredImpulsesJob as far as I can tell; just a standard IJobEntity scheduled in a standard way

Can I ask what DamageableComponents.Update(ref state); does in your system update?

shell crater
shell crater