Unity内实现无卡顿取图像推流/截屏等功能

文章目录

  • 一、Unity提供的ScreenCapture取图像接口
  • 二、我们一个一个看API:
  • 三、Unity日本大神keijiro还提供了一种异步截图的方案,完整代码如下:

一、Unity提供的ScreenCapture取图像接口

众所周知,Unity提供了ScreenCapture API用来获取引擎最终渲染到屏幕的图像:
Unity内实现无卡顿取图像推流/截屏等功能_第1张图片

二、我们一个一个看API:

1.CaptureScreenshot是一个很单纯的给一个文件名将屏幕保存一张图像到磁盘的接口,而实际项目中我们需要对屏幕截图做很多操作,所以该API不太适用。

using UnityEngine;
// Generate a screenshot and save it to disk with the name SomeLevel.png.
public class ExampleScript : MonoBehaviour
{<

你可能感兴趣的:(unity,游戏引擎,unity3d)