Version: 5.3 (switch to 5.4b)
言語English
  • C#
  • JS

スクリプト言語

好きな言語を選択してください。選択した言語でスクリプトコードが表示されます。

Camera.Render

マニュアルに切り替える
public void Render();

説明

手動でカメラをレンダリングします。

これはカメラをレンダリングします。カメラのクリアフラグ、ターゲットテクスチャ、他すべての設定を使用します。

カメラは OnPreCullOnPreRenderOnPostRender がアタッチされた任意のスクリプトに送信し、最終的な画像フィルターをレンダリングします。

これはレンダリング順を正確に制御を受け取るために使用します。この機能を使用するには カメラを作成し、カメラを無効にします。そして、カメラ上でレンダーが呼び出されます。

現在レンダリングしているカメラから Render 関数を呼び出すことはできません。 もしこれをしたい場合、カメラのコピーを作成と、CopyFrom を使ってオリジナルのカメラと一致するものにします。

See Also: RenderWithShader.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { Texture2D RTImage(Camera cam) { RenderTexture currentRT = RenderTexture.active; RenderTexture.active = cam.targetTexture; cam.Render(); Texture2D image = new Texture2D(cam.targetTexture.width, cam.targetTexture.height); image.ReadPixels(new Rect(0, 0, cam.targetTexture.width, cam.targetTexture.height), 0, 0); image.Apply(); RenderTexture.active = currentRT; return image; } }