Answer the question
In order to leave comments, you need to log in
How to implement shooting from the object's camera with subsequent saving of these pictures in a separate folder?
It is necessary to implement an imitation of the flight of a UAV surveying the area
Answer the question
In order to leave comments, you need to log in
Make two requests in a transaction, this will be the most reliable.
This is done via RenderTexture , Camera.targetTexture and Texture2D.EncodeToJPG or Texture2D.EncodeToPNG :
// Создаём временную рендер-текстуру
var renderTexture = RenderTexture.GetTemporary(Screen.width, Screen.height);
// Рендерим в неё картинку с камеры
camera.targetTexture = renderTexture;
camera.Render();
var active = RenderTexture.active;
RenderTexture.active = renderTexture;
{
// Превращаем рендер-текстуру в Texture2D
var texture = new Texture2D(renderTexture.width, renderTexture.height);
texture.ReadPixels(new Rect(0, 0, texture.width, texture.height), 0, 0);
texture.Apply();
}
RenderTexture.active = active;
RenderTexture.ReleaseTemporary(renderTexture);
// Превращаем текстуру в файл с помощью Texture2D.EncodeToJPG или Texture2D.EncodeToPNG
// Сохраняем на диск
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question