unity RenderTexture

using UnityEngine;
using System.Collections;

public class RenderTextureTest : MonoBehaviour
{
private RenderTexture RT;
// Use this for initialization
void Start()
{
RT = new RenderTexture(256, 128, 16, RenderTextureFormat.ARGB32);
RT.Create();

GetComponentInChildren<Camera>().targetTexture = RT;
}

对于RenderTexture这个东西一直很是不解,因为他没有具体的赋值方法,对api一番试用后,大概知道它里面是自动赋值的。赋值的过程应该是在获取到摄像机后等于RenderTexture之时就把摄像机画面赋予它。这跟我们传统的把右边的赋值给左边有点不同,不知道是我理解错误还是这个api确实有些特殊。

 

posted @ 2017-05-31 10:51  joson_zeng  阅读(359)  评论(0编辑  收藏  举报