  We give a universal approach to the deformation-obstruction theory of objects
of the derived category of coherent sheaves over a smooth projective family. We
recover and generalise the obstruction class of Lowen and Lieblich, and prove
that it is a product of Atiyah and Kodaira--Spencer classes. This allows us to
obtain deformation-invariant virtual cycles on moduli spaces of objects of the
derived category on threefolds.
