{I+=codeWee;}
[Unity3d] How to save RenderTexture to file
	public static void Save(this RenderTexture renderTexture, string file)
	{
		RenderTexture.active = renderTexture;
		Texture2D texture = new Texture2D(renderTexture.width, renderTexture.height, TextureFormat.ARGB32, false, false);
		texture.ReadPixels(new Rect(0, 0, renderTexture.width, renderTexture.height), 0, 0);
		texture.Apply();

		byte[] bytes = texture.EncodeToPNG();
		UnityEngine.Object.Destroy(texture);

		System.IO.File.WriteAllBytes(file, bytes);

	}
HTML | PHP | C++ | DirectX11 | Javascript | C# | HTML5 | ASP | SQL | General | CSS | Oculus Rift | Unity3d | Virtools SDK | Tip | NSIS | PowerShell | node.js | Web API | RTSP | All
Copyright© 2016 CodeWee.com All rights reserved.