# Batch

Class · category: Graphics

Source: https://github.com/playcanvas/engine/blob/f059dc005842f76e052cdf44d8370c8c7ec475ac/src/scene/batching/batch.js#L14

Holds information about batched mesh instances. Created in [BatchManager#create](https://api.playcanvas.com/engine/classes/BatchManager.md#create).

## Constructors

### constructor

```ts
new Batch(meshInstances: MeshInstance[], dynamic: boolean, batchGroupId: number)
```

Create a new Batch instance.

**Parameters**

- `meshInstances` ([`MeshInstance`](https://api.playcanvas.com/engine/classes/MeshInstance.md)`[]`): The mesh instances to be batched.
- `dynamic` (`boolean`): Whether this batch is dynamic (supports transforming mesh
  instances at runtime).
- `batchGroupId` (`number`): Link this batch to a specific batch group. This is done
  automatically with default batches.

## Properties

### batchGroupId

```ts
batchGroupId: number
```

Link this batch to a specific batch group. This is done automatically with default batches.

### dynamic

```ts
dynamic: boolean
```

Whether this batch is dynamic (supports transforming mesh instances at runtime).

### meshInstance

```ts
meshInstance: MeshInstance = null
```

A single combined mesh instance, the result of batching.

### origMeshInstances

```ts
origMeshInstances: MeshInstance[]
```

An array of original mesh instances, from which this batch was generated.

## Methods

### destroy

```ts
destroy(scene: Scene, layers: number[]): void
```

Removes the batch from the layers and destroys it.

**Parameters**

- `scene` ([`Scene`](https://api.playcanvas.com/engine/classes/Scene.md)): The scene.
- `layers` (`number[]`): The layers to remove the batch from.
