Skip to content

Format

typescript
RenderTexture.CreateRenderTexture(width, height, colorFmt, depth, aa, mip)

class: RenderTexture

Description

Create a render texture.

Parameters

param_nametypedescription
widthnumberThe width of the texture.
heightnumberThe height of the texture.
colorFmtRenderTextureFormatThe format of the render texture.
depthDepthTypeWhether to create a depth texture.
aaAntiAliasingLevel?The anti-aliasing level.
mipboolean?Whether to generate mipmap levels.

Return

typedescription
RenderTexture

Code Example

typescript
function Test() {
    try {
        let temp_texture = RenderTexture.CreateRenderTexture(100, 100, RenderTextureFormat.Default, DepthType.Depth24Stencil8, AntiAliasingLevel.x8, true);
        let pixel = temp_texture.GetPixel(10,20,1)
    } catch (error) {
        Debug.Log(error);
    }
}