You’ll need to create a new C++ class inheriting from GameViewportClient, copy the code I posted into the header/cpp file (renaming it to match your class name etc), and set that as your viewport class in project settings.
If you’re not familiar with C++ you’ll probably want to watch a few tutorials on that, and those instructions will make sense.