private void SaveScreenShot(KeyCode key, String fileName) { if (Input.GetKeyDown(key)) { Int32 width = Screen.width; Int32 height = Screen.height; Texture2D texture2D = new Texture2D(width, height, TextureFormat.ARGB32, false); texture2D.ReadPixels(new Rect(0f, 0f, (Single)width, (Single)height), 0, 0, false); texture2D.Apply(); Byte[] bytes = texture2D.EncodeToPNG(); String path = "D:/ " + fileName + ".png"; File.WriteAllBytes(WMUtils.EnsurePath(path), bytes); } }