Question by
CodingNerro · Sep 28, 2020 at 05:54 PM ·
raycastlayersraycasthitraycasthit2dlayermask
RayCastHit 2d with layerMask not workin
RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.positiveInfinity, LayerMask.GetMask("Output"));
if (hit.collider != null)
{
print("Hit an output " + hit.collider.gameObject.layer);
//code
}
Output: Hit an output 0
Comment
Your answer
Follow this Question
Related Questions
My layers seem to be completely broken 0 Answers
How to make raycast only collide with two layers? 3 Answers
Use Layer Collision Matrix for Raycast 1 Answer
RaycastHit2D problem 0 Answers