ScreenCapture.CaptureScreenshot is not working in 2017.1
Hi, After updated to Unity 2017.1 my ScreenCapture.CaptureScreenshot code is not working properly. It generates screenshot of random window/panels, sometimes including the "game" window. The same code worked just fine in 5.6 (I know it was called Application.CaptureScreenshot prior to 2017.1)
Is anyone else having this issue? What is the work around?
TIA
Answer by davedev · Jul 20, 2017 at 12:09 PM
Documentation says its been removed:
https://docs.unity3d.com/ScriptReference/Application.CaptureScreenshot.html
I know "Application.CaptureScreenshot" been removed. That is why I specially mentioned in the title and in the description that I am using "ScreenCapture.CaptureScreenshot". -_- Anyhow I am getting this weird issue with this latest ScreenCapture.CaptureScreenshot function. It worked fine in 5.6 when I was using Application.CaptureScreenshot
Hi, have the same problem. "Application.CaptureScreenshot" worked in 5.6 and now the new "ScreenCapture.CaptureScreenshot" is not working at all. I need to capture an ArchViz animation, witch i did with the new timeline tool and now i do not know what to do. Anyone knows how to get this working again? thanks in advance
Why was this upvoted? You clearly didn't read the question.
Answer by BonyYousuf · Jul 27, 2017 at 04:21 PM
Just found out that, if you set your game view to "Free Aspect" then this problem is less likely to happen. But it is still not guaranteed.
Answer by RoyalGamesBE · Sep 04, 2017 at 12:57 PM
private bool m_screenShotLock = false;
private void LateUpdate()
{
if (Input.GetKeyDown(KeyCode.S) && !m_screenShotLock)
{
m_screenShotLock = true;
StartCoroutine(TakeScreenShotCo());
}
}
private IEnumerator TakeScreenShotCo()
{
yield return new WaitForEndOfFrame();
var directory = new DirectoryInfo(Application.dataPath);
var path = Path.Combine(directory.Parent.FullName, string.Format("Screenshot_{0}.png", DateTime.Now.ToString("yyyyMMdd_Hmmss")));
Debug.Log("Taking screenshot to " + path);
ScreenCapture.CaptureScreenshot(path);
m_screenShotLock = false;
}
This code worked for me - it seemed that using LateUpdate alone did not do the trick. But using a Coroutine and waiting for end of frame worked finally.
I did not have the exactly same problem as every sceenshot turned out as black image for me, but I hope that helps anyone.
It working in editor. But on Android Device it does not work.
Answer by SandLantern · Apr 16, 2019 at 09:16 PM
For me, I needed to make sure to go to the package manager, select "Built-in packages" and then Make sure that Screen Capture and Image Conversion were both enabled.
Your answer
Follow this Question
Related Questions
Weird black lines appearing on Unity 5.4 0 Answers
GetInstanceID not unique 2 Answers
Problem with Transform.... 0 Answers
Cubemap Mip-blending inaccurate? 0 Answers
Why does Play In Editor close my currently Running Standalone Copy 0 Answers