Version: Unity 6.5 (6000.5)
LanguageEnglish
  • C#

PhysicsHandle

struct in Unity.U2D.Physics

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

Description

An abstract handle that can be used for custom purposes such as handling miscellaneous physics object types abstractly. You can create a handle with PhysicsHandle.Create or PhysicsHandle.CreateBatch. You can destroy a handle with PhysicsHandle.Destroy or PhysicsHandle.DestroyBatch. You can also get a handle from one of the following physics objects: PhysicsBody.physicsHandlePhysicsShape.physicsHandlePhysicsChain.physicsHandlePhysicsJoint.physicsHandlePhysicsDistanceJoint.physicsHandlePhysicsFixedJoint.physicsHandlePhysicsHingeJoint.physicsHandlePhysicsIgnoreJoint.physicsHandlePhysicsRelativeJoint.physicsHandlePhysicsSliderJoint.physicsHandlePhysicsWheelJoint.physicsHandle

NOTE: When retrieving the handle from another physics object, the object type is not encoded so that must be handled separately. Because of this, it's entirely possible for two handles to be equal, differing only by the type they came from so care must be taken or the object type explicitly stored against handles.

Properties

Property Description
generation Get the handle generation.
index Get the handle index.
isPoolHandle Checks if the physics handle is from the physics handle pool or not. This will return false unless thePhysicsHandle was explicitly created with PhysicsHandle.Create or PhysicsHandle.CreateBatch.
isValid Checks if the physics handle is valid in the physics handle pool. This will only work correctly if the PhysicsHandle was explicitly created with PhysicsHandle.Create or PhysicsHandle.CreateBatch. If the handle comes from another physics object, it will not validate that object and a warning will be issued.

Public Methods

Method Description
Destroy Destroy the handle. This will only work correctly if the PhysicsHandle was explicitly created with PhysicsHandle.Create or PhysicsHandle.CreateBatch. NOTE: If the handle comes from another physics object, it will not destroy that object and a warning will be issued.

Static Methods

Method Description
Create Create a PhysicsHandle.
CreateBatch Create a batch of PhysicsHandle.
DestroyBatch Destroy the specified span of PhysicsHandle. NOTE: If any of the handles come from another physics object, it will not destroy that object and a warning will be issued.