Skip to main content
1 of 3
Philipp
  • 121.5k
  • 28
  • 261
  • 342

It appears like your "playerBird" game object has no component of type Collider2D. Make sure that one of the 2D colliders is attached. When you want to find it via GetComponent, then it must be attached to the object directly. When the collider is attached to a sub-object of the "playerBird", use GetComponentInChildren instead.

Also keep in mind that there are also colliders which do not have the prefix "2D". These are 3d colliders used by the 3d physics engine. 2d and 3d colliders are completely separated systems and do not interact with each other.

Philipp
  • 121.5k
  • 28
  • 261
  • 342