Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
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

avatar image
0
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
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

  • Sort: 
avatar image
0
Best Answer

Answer by Landern · Apr 18, 2016 at 01:13 PM

It's "Raycast" with a lower case "c", not "RayCast" with an uppercase "C".

Physics.Raycast documentation.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image mikehayes00 · Apr 18, 2016 at 01:17 PM 0
Share

ahh the curse of case sensitive strikes again thanks

avatar image
0

Answer by M-Hanssen · Apr 18, 2016 at 01:13 PM

It's Physics.Raycast() and not Physics.RayCast() !!! Use intellisense to avoid these problems ;-)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Follow this Question

Answers Answers and Comments

56 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do I check if a GameObject is within or colliding with an arc? 1 Answer

Shoot towards mouse except mouse y 1 Answer

Calculating Raycasting on terrain? Why cant it hit the surface instead of under or 5 feet above the terrain? 0 Answers

Hi guys, I need help with C# Scripting using Raycast. 1 Answer

How to add a editing option to variables in a script in Inspector? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges