Secondary camera view within main window (picture-in-picture)

Forgive me if this is a stupid question: when I add a camera inside the UE4 editor, I get a little window showing me that camera’s perspective.

Is there a way to do a similar thing inside the game, and set a secondary viewport inside the main viewport, or inside a UMG widget?

Yes,

First you need to create a blueprint with a SceneCapture component in it. Then create render target in the assets. Use this rendertarget as the target for the scenecapture component.

Create a new material(unlit) with a texture. Put the rendertarget as the source of texture. Then connect the output to the emissive channel.

Later within your HUD, use the DrawMaterial node and draw a rectangle. Use the material created above as the material for this node.

Now place the Actor we created in the scene and adjust its rotation and position so that it captures the part of the world that you want to show inside the overlay. You’ll also need to adjust the scenecapture components properties as well. Ideally you should create a construction script to make it very flexible.