public string MakeMiniature(Guid projectGuid) { var camGo = new GameObject(); var cam = camGo.AddComponent <Camera>(); cam.cullingMask = LayerMask.GetMask("Area"); var bounds = areaRenderer.GetBounds(); camGo.transform.LookAt(bounds.center, Vector3.up); var size = bounds.size.magnitude; var distanceFromPoint = (Camera.main.transform.position - bounds.center).magnitude; cam.fieldOfView = 2.0f * Mathf.Rad2Deg * Mathf.Atan((0.5f * size) / distanceFromPoint); var targetTexture = new RenderTexture(200, 200, 0); targetTexture.antiAliasing = 8; targetTexture.Create(); var previousTexture = RenderTexture.active; RenderTexture.active = targetTexture; cam.targetTexture = targetTexture; cam.Render(); var texture = new Texture2D(200, 200); texture.ReadPixels(new Rect(0, 0, texture.width, texture.height), 0, 0, false); texture.Apply(); var textureData = texture.EncodeToPNG(); var path = Path.Combine(Application.persistentDataPath, projectGuid.ToString(), SaveFile.miniaturesPath); var filename = Guid.NewGuid() + ".png"; var fullPath = Path.Combine(path, filename); Directory.CreateDirectory(path); using (var file = File.Open(fullPath, FileMode.OpenOrCreate)) { file.Write(textureData, 0, textureData.Length); } Destroy(camGo); RenderTexture.active = previousTexture; targetTexture.Release(); return(filename); }