Unity 3 Beta - Trouble converting script over

Hi there,

I’m just having a little trouble converting a project over to unity 3, for some reason this bit of code doesn’t seem to work -

if (LeftButtonObj.collider.Raycast (ray, Hit, 100)
Unity gets the error -
MissingMethodException: Method not found: ‘UnityEngine.MeshCollider.Raycast’.

It’s weird because it worked fine before.

Any ideas?
Thanks
Pete

Use Physics.Raycast

See this thread

Damn. I tried adding #pragma strict but it had no effect.
I think it might be because I am using a mesh collider but I’m not sure.
I’m also not sure that I want to shift it to Physics.Raycast as collider Raycast seemed to nicely limit it to this one collider. Which allowed me to control it a little more.

Also seems kinda frustrating seeing it was already working fine :roll:

Also the example in help seems to be what I have in my script… Hmm not sure.

Oh no, I figure something out but it seems a little buggy, it seems that it only works when it’s in Update, which is a bummer because I pulled it out of update to optimise…

Anyway I whipped up this script that demonstrates the issue, if anyone has a sec, maybe check it out.