I am new in Unity. I’m trying to make a code that will take a screenshot of a object inside scrollview. My problem is that the whole object/image inside the scrollView is not visible in device.I have to pan the scrollView to see the hidden/remaining part of the object.What I wanna do is to take the screenshot of the whole object/image inside the scrollview. Please help
My code below is
private IEnumerator TakeScreenshot()
{
yield return new WaitForEndOfFrame();
var width = Screen.width;
var height = Screen.height;
var tex = new Texture2D(width, height, TextureFormat.RGB24, false);
// Read screen contents into the texture
tex.ReadPixels(new Rect(0, 0, width, height), 0, 0);
tex.Apply();
byte[] screenshot = tex.EncodeToPNG();
}
Code above only takes the screenshot that is visible to the device screen. I want to take the screenshot the whole object/image. Please help