I tried to use the Raycast to catch object in 2D scene (sprites) but did not succeed.
Following the image, I want to get the object that is in the ground and take up to a platform where it will end the stage.
Just guessing, but i think you are probably casting in the wrong direction.
Also use Physics2D if you are working with Unitys 2D framework.
I made change but did not succeed.