Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

SkinnedMeshRenderer.GetVertexBuffer

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

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.

Close

Cancel

Switch to Manual

Declaration

public GraphicsBuffer GetVertexBuffer();

Returns

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

Description

Retrieves direct access to this renderer's deformed vertex data for the current frame.

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 vertexBufferTarget or EditorGraphicsSettings.defaultMeshBufferTarget. Bind the buffer as a shader parameter by using ComputeShader.SetBuffer, Material.SetBuffer, or a similar method.

Additional resources: vertexBufferTarget, GetPreviousVertexBuffer.