Error when using Raycast to determine if grounded

Hey everyone, first time poster. Anyways, I’m trying to get a basic script working that will determine if the object is grounded using Raycast. The code was from another post on these forums, but when I attempt to replicate it, I just get an error.

using UnityEngine;
using System.Collections;

public class cubemove : MonoBehaviour {
	float distToGround;
	void Start () {
		distToGround = collider.bounds.extents.y;
	}

        ...

    public bool isGrounded(){
		return Physics.Raycast(transform.position, -Vector3.up, distToGround + 0.1, Physics.DefaultRaycastLayers);
	}
}

Building this, I get the following error: Error CS1502: The best overloaded method match for ‘UnityEngine.Physics.Raycast(UnityEngine.Vector3, UnityEngine.Vector3, float, int)’ has some invalid arguments (CS1502) (Assembly-CSharp)

I’ve checked the API repeatedly, and that constructor definitely exists for Raycast. Does anyone see where I’ve messed up?

Thanks in advance!

In C# you need to add a ‘f’ at the end of a number to denote it’s a float so your 1.0 needs to be 1.0f

using UnityEngine;
using System.Collections;

public class cubemove : MonoBehaviour {

    float distToGround;

    void Start () {
		distToGround = collider.bounds.extents.y;
    }

    public bool isGrounded(){
        return Physics.Raycast(transform.position, -Vector3.up, distToGround + 0.1f, Physics.DefaultRaycastLayers);
    }
}

Jeez, I’m an idiot. Shows how unfamiliar I am with C#. Anyways, thanks a ton!