So I’ve tried searching the web for this answer and it seems to be very specific but I’m using HighResShot to make thumbnails for menus and using the flag bMaskUsingCustomDepth as explained here: Taking Screenshots | Unreal Engine 4.27 Documentation
This works very great in the editor as it only renders the character that has depth enabled and not the background.
But in a packaged game, it renders the entire background as if custom depth isn’t working.
Editor
Packaged