Legacy Documentation: Version 4.6(go to latest)
Language: English
  • C#
  • JS
  • Boo

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Graphics.Blit

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static function Blit(source: Texture, dest: RenderTexture): void;
public static void Blit(Texture source, RenderTexture dest);
public static def Blit(source as Texture, dest as RenderTexture) as void
public static function Blit(source: Texture, dest: RenderTexture, mat: Material, pass: int = -1): void;
public static void Blit(Texture source, RenderTexture dest, Material mat, int pass = -1);
public static def Blit(source as Texture, dest as RenderTexture, mat as Material, pass as int = -1) as void
public static function Blit(source: Texture, mat: Material, pass: int = -1): void;
public static void Blit(Texture source, Material mat, int pass = -1);
public static def Blit(source as Texture, mat as Material, pass as int = -1) as void

Parameters

source Source texture.
dest Destination RenderTexture, or null to blit directly to screen.
mat Material to use for copying. Material's shader could do some post-processing effect, for example.
pass If -1 (default), draws all passes in the material. Otherwise, draws given pass only.

Description

Copies source texture into destination render texture.

This is mostly used for implementing image effects, and requires Unity Pro.

Blit sets dest to be active render texture, sets source as _MainTex property on the material, and draws a full-screen quad.

See Also: Graphics.BlitMultiTap, image effects.

	// Copies aTexture to rTex and displays it in all cameras.

var aTexture : Texture; var rTex : RenderTexture;

function Start() { if(!aTexture || !rTex) Debug.LogError("A texture or a render texture are missing, assign them."); }

function Update () { Graphics.Blit (aTexture, rTex); }
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public Texture aTexture;
    public RenderTexture rTex;
    void Start() {
        if (!aTexture || !rTex)
            Debug.LogError("A texture or a render texture are missing, assign them.");
        
    }
    void Update() {
        Graphics.Blit(aTexture, rTex);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	public aTexture as Texture

	public rTex as RenderTexture

	def Start() as void:
		if (not aTexture) or (not rTex):
			Debug.LogError('A texture or a render texture are missing, assign them.')

	def Update() as void:
		Graphics.Blit(aTexture, rTex)