Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


IsFilteringDepth(GameObject)

Checks if the Transform for obj is within the depth range to be filtered.
Read time 1 minuteLast updated 6 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.Physics2DModule
public bool IsFilteringDepth(GameObject obj)

Parameters

The GameObject used to check the z-position (depth) of Transform.position.

Returns

Type

Description

boolReturns true when
obj
is excluded by the filter and false if otherwise.

Remarks

Filtering is defined as including or excluding objects based upon a specific condition. Depth filtering checks the z-position of a GameObject Transform.position and includes it when it is within the depth range and excludes it if otherwise. IsFilteringDepth returns true when ContactFilter2D.useDepth is set to true and the
obj
transform's z-position is outside the depth defined by ContactFilter2D.minDepth and ContactFilter2D.maxDepth. This indicates the
obj
is filtered which means it should be excluded. IsFilteringDepth returns false if otherwise. Note:: Setting ContactFilter2D.useOutsideDepth to true inverts the function behavior and it returns opposite results. Additional Resources: ContactFilter2D.useDepth, ::ref:minDepth & ContactFilter2D.maxDepth.