예제 #1
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var job = new SetInitialHeadingJob
            {
                Commands = m_Barrier.CreateCommandBuffer().ToConcurrent(),
                Random   = new Random(0xabcdef)
            };
            var handle = job.Schedule(this, inputDeps);

            m_Barrier.AddJobHandleForProducer(handle);
            return(handle);
        }
예제 #2
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var job = new SetInitialHeadingJob
        {
            CommandBuffer = m_EntityCommandBufferSystem.CreateCommandBuffer(),
            Random        = new Random(0xabcdef)
        };
        //this needs ti be single or else it will error out
        var handle = job.ScheduleSingle(this, inputDeps);

        // SpawnJob runs in parallel with no sync point until the barrier system executes.
        // When the barrier system executes we want to complete the SpawnJob and then play back the commands (Creating the entities and placing them).
        // We need to tell the barrier system which job it needs to complete before it can play back the commands.
        m_EntityCommandBufferSystem.AddJobHandleForProducer(handle);
        return(handle);
    }