我想从 Unity3d 虚拟相机中捕获帧,然后让它们显示在另一个原始图像上。结果是原始图像屏幕闪烁得很厉害。
using UnityEngine;
using UnityEngine.UI;
public class RawImageVirtualWebCamTexture : MonoBehaviour
{
private RawImage rawimage;
void Start()
{
GameObject obj = GameObject.Find("RawImageTransform");
rawimage = obj.GetComponent<RawImage>();
}
void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (source != null)
{
rawimage.texture = source;
}
Graphics.Blit(source, destination);
}
}
我想看到流畅的画面。但是怎么做呢?