Camera camera;
SpriteRenderer sprRender;
Texture2D t2d = New Texture2D(1300, 760, TextureFormat.RGB24, false)
RenderTexture rt = New RenderTexture(1300, 760, 24)
camera.targetTexture = rt
camera:Render()
RenderTexture.active = rt
t2d:ReadPixels(New Rect(0, 0, rt.width, rt.height), 0, 0)
t2d:Apply()
RenderTexture.active = null
camera.targetTexture = null
Sprite spr = Sprite.Create(t2d,New Rect(0, 0, rt.width, rt.height), New Vector2(0, 0))
sprRender.sprite = spr
--将图片保存起来
byte[] byts = t2d:EncodeToJPG()
WriteAllBytesToFile(Application.dataPath .. "//" .. "currentMap.jpg", tostring(byts))