Unity already provides a bunch of methods to perform the most tasks a lot faster. However, still there is a gap for some useful extensions. The extensions I came up with are listed below. In addition, you can find the .cs file as an attachment.

Some of the extensions are related to the game I am currently building. Thus, do not expect every extension to be a useful one.

GameObject

  • GetFullPath
  • SetLayerRecursively
  • ApplyLayerCacheRecursively
  • GetParentRoot
  • GetComponentsExecpt
  • RemoveComponentsExecpt
  • FindSameHierarchicalGameObjectWithName
  • GetComponentsInAllChildren
  • ClearTransform
  • AddComponentIfNotExistent
  • RemoveComponentIfExistent
  • CalculateLocalBounds

Transform

  • GetFullPath
  • EnumerateHierarchy
  • EnumerateHierarchyCore
  • GetColliderBounds
  • IsParentOrChildOf
  • RotateYToPoint
  • FindRecursively
  • FindRecursivelyByTag
  • FindSeveralRecursivelyByTag
  • GetComponentWithAttribute

Vector3

  • SetXAxisToZero
  • SetYAxisToZero
  • SetZAxisToZero
  • WorldToCanvas
  • CalculateVelocity
  • Mult

Canvas

  • WorldToCanvasPosition
  • ScreenToCanvasPosition
  • ViewportToCanvasPosition

Collider

  • PositionOfMouseOnCollider
  • PositionOfMouseOnColliderOnly

Enums

  • GetAttribute

PointerEventData

  • RayCastHit
  • RayCastHits
  • FindFirstParentWithComponent

For a faster access through the whole source-code, the “QuickAccess.cs” provides some common functionality. It won’t compile, since it contains enums which aren’t attached to this thread.

Source-Code is available via download (.zip)