Version: Unity 6.3 Beta (6000.3)
LanguageEnglish
  • C#

PhysicsShape.Destroy

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public bool Destroy(bool updateBodyMass, int ownerKey);

Parameters

Parameter Description
updateBodyMass Optional flag indicating if the body mass configuration should be updated. Not doing so is faster, especially when destroying multiple shapes.
ownerKey Optional owner key returned when using PhysicsShape.SetOwner.

Returns

bool If the shape was destroyed or not.

Description

Destroy the shape, destroying all 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 MassConfiguration.