ApplySnapshot(Snapshot)
Restore this world to the state captured in snapshot, in place. The world keeps the same handles, so any PhysicsBody, PhysicsShape and PhysicsJoint you already hold remain valid. Applying a snapshot taken from a different world means existing handles for this world may alias objects restored from the snapshot or report invalid. The snapshot image is fully validated before the world is touched, so a rejected snapshot leaves the world unchanged.
Read time 1 minuteLast updated 14 days ago
Definition
- Type: Method
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
public bool ApplySnapshot(PhysicsWorld.Snapshot snapshot)
Parameters
A snapshot produced by PhysicsWorld.CreateSnapshot on a compatible world.
Returns
Type | Description |
|---|---|
| bool | Whether the world was restored. Returns false if the snapshot or world is invalid, or the image is rejected, in which case the world is unchanged. |
Remarks
Validating and applying a snapshot processes the whole image, so this is not intended to be called at high frequency.