Version: 2017.4
  • C#
  • JS

Script language

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


Suggest a change


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.


Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.



public method GetNativeBufferPtr(): IntPtr;
public IntPtr GetNativeBufferPtr();


IntPtr Pointer to the underlying graphics API buffer.


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

Use this function to retrieve a pointer/handle corresponding to the compute buffer, as it is represented in the native graphics API. This can be used to enable compute buffer data manipulation from native code plugins.

The type of data returned depends on the underlying graphics API: ID3D11Buffer on D3D11, ID3D12Resource on D3D12, buffer "name" (as GLuint) on OpenGL/ES, MTLBuffer on Metal. Platforms that do not support compute shaders will always return NULL.

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 buffer pointers only at initialization time.

See Also: Native code plugins.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。