A measurement of CP-violating observables in B±→D∗K± and B±→D∗π± decays is made where the photon or neutral pion from the D∗→Dγ or D∗→Dπ0 decay is not reconstructed. The D meson is reconstructed in the self-conjugate decay modes, D→KS0π+π− or D→KS0K+K−. The distribution of signal yields in the D decay phase space is analysed in a model-independent way. The measurement uses a data sample collected in proton-proton collisions at centre-of-mass energies of 7, 8, and 13 TeV, corresponding to a total integrated luminosity of approximately 9 fb−1. The B±→D∗K± and B±→D∗π±CP-violating observables are interpreted in terms of hadronic parameters and the CKM angle γ, resulting in a measurement of γ=(92−17+21)∘. The total uncertainty includes the statistical and systematic uncertainties, and the uncertainty due to external strong-phase inputs.