Format
typescript
RenderTexture.CreateRenderTexture(width, height, colorFmt, depth, aa, mip)class: RenderTexture
Description
Create a render texture.
Parameters
| param_name | type | description |
|---|---|---|
| width | number | The width of the texture. |
| height | number | The height of the texture. |
| colorFmt | RenderTextureFormat | The format of the render texture. |
| depth | DepthType | Whether to create a depth texture. |
| aa | AntiAliasingLevel? | The anti-aliasing level. |
| mip | boolean? | Whether to generate mipmap levels. |
Return
| type | description |
|---|---|
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);
}
}