When there was nothing to do, I found the Raycast function of the class Collider2D in unity . I wondered where the beam would start from (I thought that from all points of the collider). I decided to test it, wrote the code, and as a result, the collision displays nothing. Why is that? And where are the rays coming from? Here is the test script code:
private Collider2D collider2d; private void Start() { collider2d = GetComponent<Collider2D>(); } private void Update() { RaycastHit2D[] hits = null; collider2d.Raycast(Vector2.left, hits); Debug.Log(hits == null ? "No collusion" : hits.ToString()); } I tried to do the same conclusion:
RaycastHit2D[] hits = null; Debug.Log(collider2d.Raycast(Vector2.left, hits)); As a result, the identity itself, only displays "0"
