Click here to Skip to main content
15,887,477 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
isGrounded = Physics2D.OverlapCircle(groundCheck.position,new Vector2(0.47f,0.1f), CapsuleDirection2D.Horizontal, 0,groundLayer);


What I have tried:

Im fairly new to unity so I would appreciate if you solve this.
Posted
Updated 15-Jun-23 2:06am
v2
Comments
[no name] 14-Jun-23 12:06pm    
https://docs.unity3d.com/ScriptReference/Physics2D.OverlapCircle.html

"Read the manual".

1 solution

The error message is pretty clear. The function OverlapCircle expects a floating point value (the radius of a circle) as the 2nd argument. You're supplying a vector2. The compiler is unable to convert a vector2 to a float.

Reading and interpreting error messages is a skill you'll need to develop - and believe me you will as time goes on. We all get them. The compilers give pretty good messages. This one told you exactly where it found the error - at the 2nd parameter to OverlapCircle. A simple google search revealed to me (never having used Unity) the parameters required by OverlapCircle. The error made perfect sense at that point.

You need to review the OverlapCircle method and ensure you're using it correctly.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900