Context. γ Cas is known for its unusually hard and intense X-ray emission. This emission could trace accretion by a compact companion, wind interaction with a hot sub-dwarf companion, or magnetic interaction between the star and its Be decretion disc. Aims. These various scenarios should lead to diverse dependences of the hard X-ray emission on disc density. To test these scenarios, we collected X-ray observations of γ Cas during an episode of enhanced disc activity that took place around January 2021. Methods. We investigate the variations in the disc properties using time series of dedicated optical spectroscopy and existing broadband photometry. Equivalent widths and peak velocity separations are measured for a number of prominent emission lines. Epoch-dependent Doppler maps of the Hα, Hβ, and He I λ 5876 emission lines are built to characterise the emission regions in velocity space. We analyse four XMM-Newton observations obtained between January 2021 and January 2022 at key phases of the episode of enhanced disc activity. Archival XMM-Newton, Chandra, MAXI, and RXTE-ASM data are also used to study the long-term correlation between optical and X-ray emission. Results. Optical spectroscopy unveils a clear increase in the radial extent of the emission regions during the episode of enhanced disc activity, whilst no increase in the V-band flux is recorded. Our Doppler maps do not reveal any stable feature in the disc resulting from the putative action of the companion on the outer parts of the Be disc. Whilst the hard X-ray emission is found to display the usual level and type of variability, no specific increase in the hard emission is observed in relation to the enhanced disc activity. However, at two occasions, including at the maximum disc activity, the soft X-ray emission of γ Cas is strongly attenuated, suggesting more efficient obscuration by material from a large flaring Be disc. In addition, there is a strong correlation between the long-term variations in the X-ray flux and the optical variations in the V-band photometry. Conclusions. The observed behaviour of γ Cas suggests no direct link between the properties of the outer regions of the Be disc and the hard X-ray emission, but it favours a link between the level of X-ray emission and the properties of the inner part of the Be disc. These results thus disfavour an accretion or colliding wind scenario.