Unity3D and Raycasts in a 2D Scene

Note to self: When using RaycastHit2D in Unity make sure that the GameObjects you’re attempting to collide with have a Rigidbody component or those rays are going to shoot right on through!  In a 2D scene where you’re not bothered about gravity its helpful to make those Rigid bodies kinematic as well else they’ll fall to nowhere. #stilllearning

An example detecting a GameObject located below a touch event:

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">