I’m trying to refine my code for a project for groundChecking and I’m having issues getting the groundCheck array to return true (I have to use a groundCheck array because my player is long and I can’t figure out how to make the groundCheck wider)
It is as the error says, all paths your logic can take must return a value. If nothing is returned in the foreach loop (ergo, there are no members in it), then a value has to be returned afterwards.
Ground checks should be done with sweep queries not overlap queries. You must always ensure that your player is DEFAULT_CONTACT_OFFSET away from any other geometry when moving it. For that reason, an overlap query should never work when performing a ground detection. Instead, cast your player’s collider downward. This will also solve the problem of your player being too “long”, as its complete shape will be used.
A sequence of overlap queries with collider stored in an array to perform a ground detection really isn’t a valid approach.