We present a new exploration of the cosmic star-formation history and dust obscuration in massive galaxies at redshifts $0.5< z<6$. We utilize the deepest 450 and 850$mu$m imaging from SCUBA-2 CLS, covering 230arcmin$^2$ in the AEGIS, COSMOS and UDS fields, together with 100-250$mu$m imaging from Herschel. We demonstrate the capability of the T-PHOT deconfusion code to reach below the confusion limit, using multi-wavelength prior catalogues from CANDELS/3D-HST. By combining IR and UV data, we measure the relationship between total star-formation rate (SFR) and stellar mass up to $zsim5$, indicating that UV-derived dust corrections underestimate the SFR in massive galaxies. We investigate the relationship between obscuration and the UV slope (the IRX-$beta$ relation) in our sample, which is similar to that of low-redshift starburst galaxies, although it deviates at high stellar masses. Our data provide new measurements of the total SFR density (SFRD) in $M_ast>10^{10}M_odot$ galaxies at $0.5<z<6$. This is dominated by obscured star formation by a factor of $>10$. One third of this is accounted for by 450$mu$m-detected sources, while one fifth is attributed to UV-luminous sources (brighter than $L^ast_{UV}$), although even these are largely obscured. By extrapolating our results to include all stellar masses, we estimate a total SFRD that is in good agreement with previous results from IR and UV data at $zlesssim3$, and from UV-only data at $zsim5$. The cosmic star-formation history undergoes a transition at $zsim3-4$, as predominantly unobscured growth in the early Universe is overtaken by obscured star formation, driven by the build-up of the most massive galaxies during the peak of cosmic assembly.