Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetVertexBuffer()

Retrieves direct access to this renderer's deformed vertex data for the current frame.
Read time 1 minuteLast updated 10 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public GraphicsBuffer GetVertexBuffer()

Returns

Type

Description

GraphicsBufferThe current frame's deformed vertex buffer. If Unity hasn't deformed the mesh yet, returns
null
.

Remarks

Use this method to retrieve the deformed vertex buffer for the current frame. Deformed vertex data is the vertex data after Unity applies skinning and blend shapes. If Unity hasn't deformed the mesh yet, no vertex buffer exists and this method returns null.
If the buffer has a target that allows compute access, such as GraphicsBuffer.Target.Raw or GraphicsBuffer.Target.Structured, you can use it to access the current frame's deformed vertex data in a ComputeShader or another shader. When Unity deforms the mesh on the GPU, the buffer already has such a target; otherwise, request one with SkinnedMeshRenderer.vertexBufferTarget or EditorGraphicsSettings.defaultMeshBufferTarget. Bind the buffer as a shader parameter by using ComputeShader.SetBuffer, Material.SetBuffer, or a similar method.