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

DefaultMeshBufferTarget

enumeration

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

Description

The options for the default GPU buffer target that Unity applies to the vertex and index buffers of meshes.

Use this enum with EditorGraphicsSettings.defaultMeshBufferTarget to control whether Unity applies an additional buffer target to the GPU buffers it creates for meshes.

On platforms that don’t support compute access, Unity doesn’t add any additional targets.

Additional resources: EditorGraphicsSettings.defaultMeshBufferTarget, Mesh.GetVertexBuffer, Mesh.GetIndexBuffer, Target.

using UnityEditor;
using UnityEditor.Rendering;
using UnityEngine;

public static class DefaultMeshBufferTargetExample
{
    [MenuItem("Example/Create Mesh Buffers With Raw Access")]
    static void CreateMeshBuffersWithRawAccess()
    {
        // Create the vertex and index buffers of every mesh with raw access,
        // so compute shaders can access mesh data by default.
        EditorGraphicsSettings.defaultMeshBufferTarget = DefaultMeshBufferTarget.Raw;
        Debug.Log($"Default mesh buffer target: {EditorGraphicsSettings.defaultMeshBufferTarget}");
    }
}

Properties

Property Description
NoneUnity doesn’t apply a project-wide default buffer target to mesh vertex and index buffers.
RawUnity creates the vertex and index buffers of every mesh with raw byte-address access.