# CreateSnapshot(Allocator)

> Capture the current simulation state of this world into a PhysicsWorld.Snapshot.

## Definition

* **Type:** Method
* **Namespace:** [Unity.U2D.Physics](/engine/6000.6/script-reference/unity/u2d/physics.md)
* **Assembly:** UnityEngine.PhysicsCore2DModule

```csharp
public PhysicsWorld.Snapshot CreateSnapshot(Allocator allocator = Allocator.Persistent)
```

### Parameters

**** (\[Allocator]\(/engine/6000.6/script-reference/unity/collections/allocator)): The allocator for the snapshot memory. This can only be [Allocator.Temp](/engine/6000.6/script-reference/unity/collections/allocator/temp.md), [Allocator.TempJob](/engine/6000.6/script-reference/unity/collections/allocator/tempjob.md) or [Allocator.Persistent](/engine/6000.6/script-reference/unity/collections/allocator/persistent.md).

### Returns

| Type                                                                                   | Description                                                                                                                   |
| -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| [Snapshot](/engine/6000.6/script-reference/unity/u2d/physics/physicsworld/snapshot.md) | A snapshot of the world that must be disposed of after use. The snapshot is not created if the world or allocator is invalid. |
