How "include" the Raycast?!

I'm learning Unity and I got this error...

Assets/RaycastHit.js(7,27): BCE0023: No appropriate version of 'UnityEngine.Physics.Raycast' for the argument list '(UnityEngine.Vector3, UnityEngine.Vector3, RaycastHit, int)' was found.

What I need to do to use the raycast!?

All the best!

more ▼

asked Apr 25 '11 at 07:19 PM

Alexandre gravatar image

5 2 2 5

Can we see the code you are using?

Apr 25 '11 at 07:22 PM oliver-jones
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

looks like you named your class RaycastHit which overrides the RaycastHit class in Unity. Physics.Raycast() doesn't know what to do with your class so it errors out. Rename your class as something else or use UnityEngine.RaycastHit when declaring your variable.

more ▼

answered Apr 25 '11 at 07:22 PM

Ben Holmes gravatar image

Ben Holmes
313 2 3 11

It's works! Thanks! :D

Apr 25 '11 at 07:32 PM Alexandre

just forgot, the problem was the class name...

Apr 25 '11 at 07:39 PM Alexandre
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Apr 25 '11 at 07:19 PM

Seen: 1654 times

Last Updated: Apr 25 '11 at 07:19 PM