error CS0117: `UnityEngine.Physics' does not contain a definition for `RayCast'

i am following a basic tutorial for raycasting in first person and have the code done the way its shown in the tutorial but for some reason the error error CS0117: UnityEngine.Physics' does not contain a definition for RayCast’ comes up.

i have tried importing it specifically using UnityEngine.Physics.Raycast

the only other script i have is the prefab firstpersoncontroller from the standard assets also so no class is called physics in it

using UnityEngine;
using System.Collections;

public class Select : MonoBehaviour {
    public RaycastHit hit;
	// Use this for initialization
	void Start () {
	
}

// Update is called once per frame
void Update () {
    Ray ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, 0));

    if (Physics.RayCast(ray, out hit, 10))
    {
        Debug.Log("Hit");
    }
}
}

i have searched for an answer to this and they do not solve my issue

1 Like

It’s “Raycast” with a lower case “c”, not “RayCast” with an uppercase “C”.

Physics.Raycast documentation.

It’s Physics.Raycast() and not Physics.RayCast() !!!
Use intellisense to avoid these problems :wink: