protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var job = new PlayerUnitSelectJob {
            commandBuffer = barrier.CreateCommandBuffer().ToConcurrent(),
            Selected      = GetComponentDataFromEntity <PlayerUnitSelect>(),
            ray           = Camera.main.ScreenPointToRay(Input.mousePosition),
        };

        return(job.Schedule(this, inputDeps));
    }
Beispiel #2
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var job = new PlayerUnitSelectJob {
            CommandBuffer = m_EntityCommandBufferSystem.CreateCommandBuffer(),
            Selected      = GetComponentDataFromEntity <PlayerUnitSelect>(),
            ray           = Camera.main.ScreenPointToRay(Input.mousePosition),
        }.Schedule(this, inputDeps);

        m_EntityCommandBufferSystem.AddJobHandleForProducer(job);

        return(job);
    }
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var job = new PlayerUnitSelectJob {
            CommandBuffer = m_EntityCommandBufferSystem.CreateCommandBuffer(),
            Selected      = GetComponentDataFromEntity <PlayerUnitSelect>(),
            ray           = Camera.main.ScreenPointToRay(Input.mousePosition),
        }.Schedule(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(job);

        return(job);
    }