Destroy(bool, int)
Destroy the shape, destroying all PhysicsShape.Contact the shape is involved in. If the object is owned with PhysicsShape.SetOwner then you must provide the owner key it returned. Failing to do so will return a warning and the shape will not be destroyed. The lifetime of the specified owner object is not linked to this shape i.e. this shape will still be owned by the owner object, even if it is destroyed. Shapes of type Chain cannot be destroyed here, they must be destroyed by their owning chain. See PhysicsChain and PhysicsBody.MassConfiguration.
Read time 1 minuteLast updated 8 days ago
Definition
- Type: Method
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
public bool Destroy(bool updateBodyMass = true, int ownerKey = 0)
Parameters
Optional flag indicating if the body mass configuration should be updated. Not doing so is faster, especially when destroying multiple shapes.
Optional owner key returned when using PhysicsShape.SetOwner.
Returns
Type | Description |
|---|---|
| bool | If the shape was destroyed or not. |