- Home /
Question by
itstimetomakelol · Jan 22, 2021 at 01:00 PM ·
scripting problemraycastphysics2draycasthit2didentifier
Identifier expected on equals symbol
I have 1 small error in this line on the equals symbol. I don't know what it is but it's probably a dumb mistake or something. I really can't see what I've done wrong.
RaycastHit2D[] = Physics2D.RaycastAll(transform.position,
directions[selectedWay].transform.position - transform.position);
Comment
Best Answer
Answer by Casiell · Jan 22, 2021 at 01:04 PM
RaycastHit2D[] is just a type, not a field declaration. You need a name for your array, so for example:
RaycastHit2D[] hits = Physics2D.RaycastAll(transform.position, directions[selectedWay].transform.position - transform.position);
Your answer
Follow this Question
Related Questions
Where should I call Physics2D.Raycast ? 0 Answers
Raycast 2D hits sprite with collider, but returns error when not hitting any collider 2 Answers
Physics2D.Raycast returns incorrect normal when casting from inside collider 1 Answer
Unity Physics2D.Raycast always returns “the invoker” as hit 2 Answers
I don't get Raycasts 0 Answers