- Home /
Can't refer to a child (with a different tag) when the parent has a rigidbody 2d
Hi! I'm a big beginner and I have a problem: I made a game in unity2d and make a sprite with children. I use raycasting to click to the child, and the child has a tag to differ from the parent that also have a tag. When I add a rigidbody2d to the parent, I can't click to the child because the ray senses the parent. I draw the ray and it goes through the child object. Can someone help me?
Answer by VoidVenom · Apr 08, 2021 at 06:34 AM
You can put the parent on the IgnoreRaycast layer or use a Layer Mask with your raycast to ignore the parent.
Your answer
Follow this Question
Related Questions
Problems with 2D RaycastHit.Collider 2 Answers
Make a simple tree 1 Answer
5.1 Interpolation on child rigidbody2d is causing the object to move slower than parent. 3 Answers
How can I make a ray stop uppon reaching a trigger? 1 Answer
Unity3D Shooter: Using tags to switch level after killing all enemies. 1 Answer