how to get viewmode console commands to work?

Hi everyone,
I tried using console commands to switch viewport modes like viewmode Lit, viewmode Unlit, and viewmode Wireframe. I am on UE5.6 on Windows. The problem is that the viewport just stays in the same mode and nothing changes at all.

The strange part is that Nanite debug commands still work perfectly. For example,
r.Nanite.Visualize clusters
r.Nanite.Visualize triangles
r.Nanite.Visualize overdraw
r.Nanite.Visualize 0

All of those update the viewport instantly, so the console itself is working. Only the regular viewmode commands do nothing now. I am not sure if this is a UE5.6 change or if my setup is messed up. For the regular viewmode tests I entered the commands exactly like this in the console: viewmode Lit or even : viewmode Unlit , and neither of them changed anything in the viewport.

EDIT:
These viewmode commands actually work when Play Mode is enabled. If I press play in the viewport then they behave exactly as expected. But when I am not playing the level and I want to switch the editor viewport without entering Play Mode, that is when nothing happens.