# Create

> Create a PhysicsWorld using the PhysicsWorldDefinition.defaultDefinition.

## Definition

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

## Create()

Create a PhysicsWorld using the [PhysicsWorldDefinition.defaultDefinition](/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition/defaultdefinition.md).

```csharp
public static PhysicsWorld Create()
```

### Returns

| Type                                                                              | Description        |
| --------------------------------------------------------------------------------- | ------------------ |
| [PhysicsWorld](/engine/7000.0/script-reference/unity/u2d/physics/physicsworld.md) | The created world. |

## Create(PhysicsWorldDefinition)

Create a PhysicsWorld.

```csharp
public static PhysicsWorld Create(PhysicsWorldDefinition definition)
```

### Parameters

**** (\[PhysicsWorldDefinition]\(/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition)): The world definition to use when creating the new physics world.

### Returns

| Type                                                                              | Description        |
| --------------------------------------------------------------------------------- | ------------------ |
| [PhysicsWorld](/engine/7000.0/script-reference/unity/u2d/physics/physicsworld.md) | The created world. |

### Remarks

You don't need to create a world before you add physics objects, because Unity automatically creates one you can fetch with [PhysicsWorld.defaultWorld](/engine/7000.0/script-reference/unity/u2d/physics/physicsworld/defaultworld.md). This method isn't thread-safe. Call it only from the main thread. A world starts running as soon as you create it. Set [PhysicsWorld.paused](/engine/7000.0/script-reference/unity/u2d/physics/physicsworld/paused.md) to `true` to pause its simulation.

Additional Resources: [PhysicsWorld.defaultWorld](/engine/7000.0/script-reference/unity/u2d/physics/physicsworld/defaultworld.md), [PhysicsWorldDefinition](/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition.md)

### Examples

```csharp
// Create a public world definition so its properties display in the
// Inspector window, then create a world from it.
using UnityEngine;
using Unity.U2D.Physics;

public class CreateWorld : MonoBehaviour
{
    public PhysicsWorldDefinition worldDefinition = new PhysicsWorldDefinition();
    public PhysicsWorld world;

    void Awake()
    {
        world = PhysicsWorld.Create(worldDefinition);
    }
}
```

## Create(Snapshot, PhysicsWorldDefinition)

Creates a new [PhysicsWorld](/engine/7000.0/script-reference/unity/u2d/physics/physicsworld.md) from `snapshot`, using `definition` for the settings a snapshot does not store.

```csharp
public static PhysicsWorld Create(PhysicsWorld.Snapshot snapshot, PhysicsWorldDefinition definition)
```

### Parameters

**** (\[Snapshot]\(/engine/7000.0/script-reference/unity/u2d/physics/physicsworld/snapshot)): A snapshot produced by [PhysicsWorld.CreateSnapshot](/engine/7000.0/script-reference/unity/u2d/physics/physicsworld/createsnapshot.md).**** (\[PhysicsWorldDefinition]\(/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition)): The world definition supplying the settings the snapshot does not store.

### Returns

| Type                                                                              | Description                                                                                                                      |
| --------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| [PhysicsWorld](/engine/7000.0/script-reference/unity/u2d/physics/physicsworld.md) | The created world restored to the snapshot state, or an invalid world if the snapshot was rejected or no world could be created. |

### Remarks

A snapshot restores the full simulation configuration, so these [PhysicsWorldDefinition](/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition.md) properties are taken from `snapshot` and their values in `definition` are ignored: [PhysicsWorldDefinition.gravity](/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition/gravity.md), [PhysicsWorldDefinition.bounceThreshold](/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition/bouncethreshold.md), [PhysicsWorldDefinition.bounceIterations](/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition/bounceiterations.md), [PhysicsWorldDefinition.bouncePropagation](/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition/bouncepropagation.md), [PhysicsWorldDefinition.contactHitEventThreshold](/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition/contacthiteventthreshold.md), [PhysicsWorldDefinition.contactFrequency](/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition/contactfrequency.md), [PhysicsWorldDefinition.contactDamping](/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition/contactdamping.md), [PhysicsWorldDefinition.contactSpeed](/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition/contactspeed.md), [PhysicsWorldDefinition.contactRecycleDistance](/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition/contactrecycledistance.md), [PhysicsWorldDefinition.maximumLinearSpeed](/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition/maximumlinearspeed.md), [PhysicsWorldDefinition.sleepingAllowed](/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition/sleepingallowed.md), [PhysicsWorldDefinition.continuousAllowed](/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition/continuousallowed.md), [PhysicsWorldDefinition.eventGroupingAllowed](/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition/eventgroupingallowed.md) and [PhysicsWorldDefinition.capacity](/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition/capacity.md). All other `definition` properties are applied normally, for example [PhysicsWorldDefinition.simulationWorkers](/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition/simulationworkers.md) and [PhysicsWorldDefinition.simulationSubSteps](/engine/7000.0/script-reference/unity/u2d/physics/physicsworlddefinition/simulationsubsteps.md). To use a value other than the snapshot's, set the matching property on the returned world after this call. Creating and restoring a world processes the whole image, so this is not intended to be called at high frequency.
