Format
typescript
RenderTexture.GetTemporary(width, height, colorFmt, depth, aa)class: RenderTexture
Description
Allocate a temporary render texture.
This method is typically used when there is a need for intermediate rendering steps in the rendering pipeline, in order to avoid frequent creation and destruction of RenderTexture objects, thus improving performance and memory utilization efficiency.
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 | The depth texture. |
| aa | AntiAliasingLevel? | The anti-aliasing level. |
Return
| type | description |
|---|---|
RenderTexture|null | The render texture. |
Code Example
typescript
function Test() {
try {
let temp_texture = RenderTexture.GetTemporary(100, 100, RenderTextureFormat.Default, DepthType.Depth24Stencil8, AntiAliasingLevel.x8);
} catch (error) {
Debug.Log(error);
}
}