I want to use Scene Capture to to take screenshots in runtime, but rather than saving them a an image file in the screenshot folder, I want a single frame of it as a texture variable I can use in a blueprint. For example, when I press the F key, the game takes a screenshot of the Scene Capture and stores it in my texture array in my blueprint so I can use later.
I tried making a Texture and TextureRender variable and assign TextureRender to Texture when I press F, but Texture updates with TextureRender. Any way to get a single frame from it?
Place your SceneCapture2D Actor in a BP with Capture Every Frame set to False.
In the Event Graph, Place two Set Relative Location nodes with the SceneCapture2D as the Target.
In the first Set Relative Location set the New Location to 0,0,0.01
In the second Set Relative Location set the New Location to 0,0,-0.01
Add a Press F key pressed event
Connect the three nodes in this order Event Key Pressed >> First Relative Location >> Second Relative Location
The nest step takes a bit more work. You will need to decide how many Render Target Textures you want to store as they must be established in the Content Browser before runtime. You can overwrite them if more is needed but this is a performance heavy activity. In this example I set up 3 different ones that will overwrite each other in a looping cycle so 0,1,2,0,1,2…
That way you don’t have to move the Capture Component 2D around twice for every snapshot. The rest of the setup is the same as Eric showed.
Screenshot is from 4.8 Preview 2.