Example #1
0
    public void OnUpdate(ref SystemState state)
    {
        // Explicitly declare:
        // - Read-Write access to Rotation
        // - Read-Only access to RotationSpeed_IJobChunkStructBased
        var rotationType      = state.GetComponentTypeHandle <Rotation>();
        var rotationSpeedType = state.GetComponentTypeHandle <RotationSpeed_IJobChunkStructBased>(true);

        var job = new RotationSpeedJob()
        {
            RotationTypeHandle      = rotationType,
            RotationSpeedTypeHandle = rotationSpeedType,
            DeltaTime = state.Time.DeltaTime
        };

        state.Dependency = job.ScheduleSingle(m_Group, state.Dependency);
    }