Screen Capture in Unity

0 votes
asked Oct 4, 2017 by rluppino (220 points)

In Unity, I'm trying to find a way to capture the entire contents of the screen (iOS and Android) when the AR Marker has been detected and my 3D model is being shown. I have tried a number of different techniques but the best result I've had so far is a screenshot of the UI layer only and not of the camera preview with rendered 3D model.

How can I achieve this? Is the PRO version required? I have seen that the PRO version has functionality for recording video of the screen but does it also have the ability to take a screenshot of everything on the screen at a particular time (and then save that to the device camera roll)?


1 Answer

0 votes
answered Oct 7, 2017 by mheruart (340 points)
I try to create screen recorder too in unity, but in the screen recorder tutorial from easyar sdk is required the pro version sdk
commented Oct 7, 2017 by rluppino (220 points)
For video recording, I think yes, the PRO version is required but I was just wanting a still image and I was able to work out how to do this.

You need to create a RenderTexture, set this to the camera's target texture and then call camera.Render(). Then create a Texture2D, call ReadPixels followed by Apply.

If you then want and image file for the screenshot, call EncodeToPNG() on the Texture2D object and save the file to your device.
Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.