Cannot implicitly convert type 'UnityEngine.Collider[]' to 'UnityEngine.Collider'

Hello,

I am following a tutorial for player movement in a 2D platformer, however as mine is in 2.5D (specifically 2D movement in a 3D world) I have had to change some of the aspects of the tutorial to address a Rigidbody instead of Rigidbody2D ect. This is the code so far that is throwing up the error:

Assets\Scripts\PlayerMovement.cs(42,32): error CS0029: Cannot implicitly convert type ‘UnityEngine.Collider[ ]’ to ‘UnityEngine.Collider’

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour {
    public float movementSpeed;
    public Rigidbody rb;

    public float jumpForce = 20f;
    public Transform feet;
    public LayerMask groundLayers;

    float mx;
    bool isGrounded;

    private void Update()
    {
        mx = Input.GetAxisRaw("Horizontal");

        if (Input.GetButtonDown("Jump") && IsGrounded ())
        {
            Jump();
        }
    }

    private void FixedUpdate()
    {
        Vector2 movement = new Vector2(mx * movementSpeed, rb.velocity.y);

        rb.velocity = movement;
    }

    void Jump()
    {
        Vector2 movement = new Vector2(rb.velocity.x, jumpForce);

        rb.velocity = movement;
    }

    public bool IsGrounded()
    {
        Collider groundCheck = Physics.OverlapSphere(feet.position, 0.5f, groundLayers);

            if (groundCheck.gameObject != null) ;
        {
            return true;

        }

        return false;
    }


}

Any help with this would be great. Thanks!

Just to assist, this error only started to occur after adding the section “public bool IsGrounded()” and the other elements which reference it.

Read the documentation: https://docs.unity3d.com/ScriptReference/Physics.OverlapSphere.html
Physics.OverlapSphere returns Collider[ ] and not just a single Collider.