Задача: сделать скриншот и сохранить картинку в базу.
Получаю изображение:
yield return new WaitForEndOfFrame();
// Create a texture the size of the screen, RGB24 format
int width = Screen.width;
int height = Screen.height;
Texture2D 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();
// Encode texture into PNG
screenShotBytes = tex.EncodeToPNG();
Destroy(tex);
Все работает отлично, но хотелось бы уменьшить размер. Я знаю как это сделать через System.Drawing, но unity похоже не признает эту библиотеку.
Пробовал tex.Resize... я так понимаю не подходит.. альтернативы есть? (я не очень хочу подключать dll ку в проект)