This question was
closed Apr 18, 2016 at 01:18 PM by
mikehayes00 for the following reason:
The question is answered, right answer was accepted
Question by
mikehayes00 · Apr 18, 2016 at 12:48 PM ·
c#scripting problemraycasting
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
Comment