Legacy Documentation: Version 5.4
LanguageEnglish
  • C#
  • JS

Script language

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

RenderTexture.GetNativeDepthBufferPtr

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

Switch to Manual
public function GetNativeDepthBufferPtr(): IntPtr;
public IntPtr GetNativeDepthBufferPtr();

Returns

IntPtr Pointer to an underlying graphics API depth buffer resource.

Description

Retrieve a native (underlying graphics API) pointer to the depth buffer resource.

Use this function to retrieve a pointer/handle corresponding to the depth buffer part of the RenderTexture, as it is represented on the native graphics API level. This can be used to enable depth buffer manipulation from native code plugins.

Use Texture.GetNativeTexturePtr to get a native pointer to the color buffer of a render texture, and this function to get to the depth buffer part. For Depth and ShadowMap render texture formats, the two functions return the same resource.

Note that calling this function when using multi-threaded rendering will synchronize with the rendering thread (a slow operation), so best practice is to set up needed texture pointers only at initialization time.

See Also: Texture.GetNativeTexturePtr, Native code plugins.