Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


drawDepth

The depth that custom drawing is drawn at when it is not tied to a body, in world space, along the axis perpendicular to the transform plane.
Read time 1 minuteLast updated 2 days ago

Definition

  • Type: Property
  • Namespace: Unity.U2D.Physics
  • Assembly: UnityEngine.PhysicsCore2DModule
public float drawDepth { get; set; }

Remarks

Custom drawing of geometry, points and lines has no body to take a depth from, so it is drawn at this depth. Set the depth before performing the custom drawing it applies to. The depth axis is Z for PhysicsWorld.TransformPlane.XY, Y for PhysicsWorld.TransformPlane.XZ and X for PhysicsWorld.TransformPlane.ZY. Drawing that belongs to a body, such as a body, shape or joint being drawn by the world, uses the depth of that body instead. See PhysicsBody.drawDepth. A value that is not finite is rejected and leaves the depth unchanged. The depth stays as set until it is changed or PhysicsWorld.ClearDraw is called, which resets it to zero.