PhysicsHandleExtensions
Extensions that let a physics handle be written through when it is reached by something other than a plain variable.
Read time 1 minuteLast updated 12 days ago
Definition
- Type: Class
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
public static class PhysicsHandleExtensions
Remarks
C# refuses an assignment made through a property or indexer that returns a value type. That rules out writing a handle's properties at any such site, however the handle itself was obtained. Each extension here returns the handle from a method instead, which C# does accept as the target of a property assignment. Every handle is a read-only struct carrying nothing but the handle itself. The returned copy therefore addresses the same underlying object, and a property written through it takes effect exactly as if it had been written through a variable.
Static Methods
Method | Description |
|---|---|
| Get | Returns this body in a form that can be written through. |