I’m trying the new 2D features of unity, and I create a sprite object, add a box collider 2D, and a simple script that uses OverlapSphere()
to detect colliders. It returns 0 colliders, even when I attach this script to an object that has a collider attached to it:
// Use this for initialization
void Start () {
Collider[] colliders = Physics.OverlapSphere(transform.position, 5);
Debug.Log(colliders.Length + " colliders in range ");
}
Obviously, at least the object itself should appear in the results… Changing to regular box collider (3D) works fine.
Any ideas? Unity bug?