Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

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

Create(): bool;
bool Create();
def Create() as bool

Description

Actually creates the RenderTexture.

RenderTexture constructor does not actually create the hardware texture; by default the texture is created the first time it is set active. Calling Create lets you create it up front. Create does nothing if the texture is already created.

See Also: Release, IsCreated functions.

var rt: RenderTexture;

function Start () {
	rt = new RenderTexture(256, 256, 16, RenderTextureFormat.ARGB32);
	rt.Create();
}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public RenderTexture rt;
    void Start() {
        rt = new RenderTexture(256, 256, 16, RenderTextureFormat.ARGB32);
        rt.Create();
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	public rt as RenderTexture

	def Start() as void:
		rt = RenderTexture(256, 256, 16, RenderTextureFormat.ARGB32)
		rt.Create()