trouble with collider2D.cast

RaycastHit2D[] test = Collider2D.Cast(new Vector2(scale_x, 0), LayerMask.GetMask("Wall"), whereto, false);

This code is not working given the error on LayerMask.GetMask(“Wall”) saying its not possible to convert an “int” into a “UnityConvert.Raycasthit2D” im really confused… since i thought i was supposed to place a contactFilter there… can anyone help me with this one?

Collider2D.Cast() returns an int with the number of results, so this error is expected here. I think you are looking for something like Physics2D.RaycastAll().

Alright i got some knowledge of how the Collider2D.Cast() works! It seems that just live vJoeyz said it returns an int with the number of results… the problem is that im trying to just like a RaycastHit2D[] test = Physics2D.RaycastAll() get a array of all objects found so then i can change my position… Its crucial that i dont use anything like raycast on my code since it might cause the player to get pushed inside a obstacle (just like it happened many times before with my older version of my code using raycast) and so i must use something that doesnt involve only a line… but the size of the player collider… Are there any other codes that might help me doing this calculation or any other way using Collider2D.cast so i can get an array of all the objects collided and not the ammount of objects found?